[ArcEngine] Drawing projected geometry

2696
16
Jump to solution
04-30-2012 07:51 AM
ManfredLauterbach
Occasional Contributor
Hi,

The documentation for the IGemetry.Project method : http://help.arcgis.com/en/sdk/10.0/arcobjects_cpp/componenthelp/index.html#/Project_Method/000w00000... shows how an object can be projected into another coordinate space.

Assuming that I am working with WGS84 referenced maps, I then want to draw a geometry (circle).
In the case of WGS84, drawing a 'circle' (with constant radius), will actually be visualized (projected) as an ellipsoid - see attached image.

My problem is that the following projection does not seem to be working :
          PointClass centroid = new PointClass() { X = 0, Y = 0};           PointClass permiterPoint = new PointClass() { X = 4, Y = 0 };           CircularArcClass circularArc = new CircularArcClass();           circularArc.PutCoords(centroid, permiterPoint, permiterPoint, esriArcOrientation.esriArcClockwise);            IPolygon polygon = new PolygonClass();           segmentCollection = polygon as ISegmentCollection;           segmentCollection.AddSegment(circularArc);            ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass();           IGeographicCoordinateSystem cs1 = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_Clarke1880);           IGeographicCoordinateSystem cs2 = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);           polygon.SpatialReference = cs1;            polygon.Project(cs2);            IGraphicTrackerSymbol graphicTrackerSymbol = graphicTracker.CreateSymbol(fillSymbol as ISymbol, null);           int graphicID = graphicTracker.Add(polygon, graphicTrackerSymbol);

(I have not added any maps yet, and have not set the any layer spacial relations).

The 'inner' circle is the result of the code above.
The 'outer' (shaded) ellipsoid is the result of another filled polygon (not in the code above) which is constructed by manually calculating the perimeter coordinates.

The source coordinate system is obviously not Clarke 1880, I just set it to Clarke to try and get a response out of the Project method.
What am I doing wrong in terms of the projection - why is the polygon not being projected into the ellipsical coordinates that are used to represent WGS 84?
0 Kudos
16 Replies
AlexanderGray
Occasional Contributor III
If you don't get the result you expect with the sample code, I would suggest you go to esri tech support.  Either the application is behaving as expected (your expectation doesn't match) or there is a bug , either way only esri can confirm it.
0 Kudos
ManfredLauterbach
Occasional Contributor
Sadly, I also came to that conclusion several weeks ago (the fact that the forums are not sufficient for support).
In the mean time I'll keep posting because I really think the solution to this is simple, and it's just a matter of being pointed in the right direction.
0 Kudos
AlexanderGray
Occasional Contributor III
The forums are as good as the people contributing to them.  Unfortunately, as a user, I cannot afford much time for testing and experimenting some times the best I can do is offer suggestions of places to look.
The cost of support varies by distributor regions and the types of contracts you have, I would find it very difficult to develop AO without some form of official support from esri.
0 Kudos
ManfredLauterbach
Occasional Contributor
Yes - thank you for your input, it is certainly appreciated.

If I may ask, how much support did you buy / consider necessary?
I'm trying to estimate how much support we will need to purchase, in contrast to the number of issues I posted, which other forum members have been able to help me resolve (i.e. Thanks Neil :))

Our specific use of Arc Objects only makes use of a smaller subset of functionality, and currently does not use any of the extensions.
It is my belief that I am quite close to a working solution and don't want to over-purchase support that will be wasted on one or two issues that I should have been able to resolve on the forums.
0 Kudos
AlexanderGray
Occasional Contributor III
Well our organization is on a maintenance contract so we get unlimited support and upgrades.  We have a few dozen ArcInfos and spatial analysts, arcviews,  server, some engine and a few other extensions, so lots of support money.  Not all distributors have the same support models.  As far as I know, Canada does not have a pay as you go model except for entreprise support.
0 Kudos
ManfredLauterbach
Occasional Contributor
Thanks for the info - our South African product specialist has replied that he'll get back to us...

In the mean time, I just want to update this thread again so that in the mean time any other knowledgeable specialist who happens to be browsing will know that we still need to resolve this issue:

TBD : How do I project a geometry object into a projected plane using ArcEngine? / (or what is wrong with the code posts above, are we supposed to be using the 'Project()' method?)
0 Kudos
ManfredLauterbach
Occasional Contributor
There seems to be insufficient information to diagnose this problem, forcing me to use a non-ESRI workaround :

I have downloaded and used a WMM (world magnetic model) library to calculate the correct coordinates whenever necessary and simply provide the correct coordinates to contruct ESRI geometries.
0 Kudos