Ways to compute distance between two points

473
3
02-21-2011 04:26 AM
orsela
by
New Contributor
I Tried computing the distance between two points using several different ways, and in some I got different results. I wonder what could be the reason.

First, I created a polyline and added the two points to it and used IPolyline.Length property.
After that I used IProximityOperator.ReturnDistance. I got the same result using these methods.

Then I tried using IMap.ComputeDistance and got a different result.

I got even more confused when I tried drawing the points on the map and measuring the distance between the points using the MapMeasureTool. When I measured the distance using Meters as the unit, I got the result of the first two methods (converted to Meters, of course). When I changed the tool units to Decimal Degrees (my map units), I got the result of the third method (IMap.ComputeDistance).

Am I missing something basic here?
Thanks
0 Kudos
3 Replies
AlexanderGray
Occasional Contributor III
Distance in decimal degrees is meaningless.  the distance between two degrees of latitude is more or less constant but the distance between two degrees of longitude is roughly 111km at the equator and 0m at the north and south pole.  Assuming your lines are short there should not be a lot of north south variation but since the length of the unit of measurement is different in the X and Y axis, length in degrees are basically meaningless.
The length reported by Ipolyline.length will be in the coordinates of the data's coordinate system.  This could be meters, feet, nautical miles and even decimal degrees.  The thing to remember is that is just the distance in the cartesian coordinate system stored in the database (X,Y coordinate system.)  Most coordinate systems depend on a map projection that defines it.  Map projections all have distortion, only equidistant projections preserve distance.  How accurate is the measurement depends on the projection, how much accuracy you need depends on the application. 

For high accuracy over long distances, there is a class called MeasurementToolClass part of the defensesolutions to do that.  I have used it back when it was part of military analyst but now it is core functionality.
0 Kudos
BarryDurand
New Contributor
orsela1@gmail.com 

Did you ever figure out a way to do this? I am trying to do something similar.
0 Kudos
JaskiratSingh
New Contributor
The last comment in the thread at the link below has a solution to find distance between two decimal degree points in meters.
link: http://forums.esri.com/Thread.asp?c=93&f=992&t=60534
0 Kudos