Select to view content in your preferred language

IFeature::Store not same for circle and square in GCS

1592
6
04-04-2010 10:47 PM
AbhijeetKulkarni
Frequent Contributor
hi all,
I am using C#.net. I have come across a typical situation. The scene goes like as below.

1. Add a graphic to Arc Map using native native drawing tool. Add one circle and one square/rectangle/any shaped polygon.

2. Select the any one graphic. In code, I take geometry of that graphic, use IArea::area and get the area. say Area1.
3. Convert the selected graphic to feature using native tools. Select the converted new feature. Take the geometry of feature. Use IArea::area and get the area. Say Area2.
4. Now if the graphic is circle then Area1 is not equal to Area2 while if the graphic is sqaure/rectangle/any other shaped polygon, then Area1 = Area2.
0 Kudos
6 Replies
NeilClemmons
Honored Contributor
How big is the difference?  I believe the geometry will be snapped to the spatial reference of the feature class when the feature is stored.  This may cause a slight variation from the original area.
0 Kudos
AbhijeetKulkarni
Frequent Contributor
Well the difference in my case is 100+ Acres.
0 Kudos
NeilClemmons
Honored Contributor
So what exactly are you doing?  You mention that you're using native tools to draw the graphic and to convert the graphic into a feature.  If so, then you aren't doing it in code so you aren't calling IFeature::Store.  If you are converting the graphic to a feature using code, then post your code and I'll take a look at it.
0 Kudos
AbhijeetKulkarni
Frequent Contributor
Sorry to mention the steps in bit wrong way. Step no 3 is -> get the geometry of selected graphic. assign it to pFeature.shape and few steps to add attributes and finally pFeature.store(). I am getting the geometry of selected graphic by using IGraphicscontainer,IGraphicscontainerSelect, IGroupElement and IElement. so PFeature.shape = pElement.geometry; and pFeature.store();
0 Kudos
NeilClemmons
Honored Contributor
The elements in the map's graphics container should have the same spatial reference as the map.  If this spatial reference is different from the spatial reference of the feature class you're adding the feature to, then you should project the geometry into the spatial reference of the feature class.  Do the map and feature class have different spatial references?
0 Kudos
AbhijeetKulkarni
Frequent Contributor
Neil
the spatial reference is same for all.There is no spatial reference issue.
0 Kudos