How to get the distance in a certain unit?

1388
2
Jump to solution
08-17-2012 09:48 AM
SuiHuang
Occasional Contributor II
Hi Everybody:

    I am writing ArcMap extension code in C# to work with a personal Geo-database. The feature classes in this GDB are all in a spatial reference that using geographic coordinate system WGS84 without any projected coordinate system. The MXD file my code working with is not expected to have any setup on the projected coordinate system.
    In the C# code when I use IProximityOperator.ReturnDistance method to find out distance between two feature in this GDB. The returned distance seems to be in the unit of degree (for Lat-Long). This result is not directly usable for me. How can I get the distance in the unit of meters?
    Thank you!
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor
In your code, before you assign the geometries to the IProximityOperator, you should project each of them into a spatial reference that best fits your data

View solution in original post

0 Kudos
2 Replies
KenBuja
MVP Esteemed Contributor
In your code, before you assign the geometries to the IProximityOperator, you should project each of them into a spatial reference that best fits your data
0 Kudos
DuncanHornby
MVP Notable Contributor
Sui,

You could also try and use the IUnitConverter Interface. Although not sure if the conversion would be accurate if your source coordinate system is in decimal degrees. I think some ArcObjects expect your geometries to be projected for them to work best?

Duncan
0 Kudos