Does the IGeometryServer2 interface work in desktop applications? My solution is an Add-in for ArcGIS 10. I'm currently passing it two valid polygon features that are in a projected coordinate system. I call the GetDistanceGeodesic() method in the following manner but it always returns infinity.

IGeometryServer2 geomServer2 = new GeometryServerClass();
var PCS = distFeat.ShapeCopy.SpatialReference as IProjectedCoordinateSystem;    
ILinearUnit unit = PCS.CoordinateUnit;    
double _dTestDist = geomServer2.GetDistanceGeodesic(distFeat.ShapeCopy.SpatialReference, distFeat.Shape, distFeat2.Shape, unit);

All the inputs have the expected values while stepping through in debug mode. I also tried using WGS84 but the results were the same.

  • 1
    Somewhat related (you might need to use pe.dll for this): gis.stackexchange.com/q/1351/753
    – blah238
    Apr 17, 2013 at 23:05
  • Thanks, I did see that question. I was hoping to get this interface working to simplify things. Apr 17, 2013 at 23:22
  • @Rich Wawrzonek Hi, are you going to use ArcGIS Server? GeometryServerClass is GeometryService which hosted by ArcGIS Server.
    – Darksanta
    Apr 17, 2013 at 23:36
  • No, this application is for desktop. One polygon comes from a file geodatabase feature class and the other from the ArcMap user interface (in memory). Apr 18, 2013 at 0:29
  • 1
    You can take a look at blogs.esri.com/esri/arcgis/2011/07/21/calculating_geodesic. According to that, after 10.0 sp2 you can calculate geodesic distances using the Calculate Field tool.
    – travis
    Apr 18, 2013 at 0:55


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.