[OpenLayers-Users] what is the Point.distanceTo(Point) return
value??
Stephen Woodbridge
woodbri at swoodbridge.com
Thu Nov 29 13:07:42 EST 2007
plen wrote:
> Hello,
>
> I have two Point coordinates that I want to find out what the distance
> between them is. I saw that the OpenLayers.Geometry.Point class has a
> distanceTo function. This is what I tried....
>
> var SWpoint = new OpenLayers.Geometry.Point(SWlng, SWlat);
> var NEpoint = new OpenLayers.Geometry.Point(NElng, NElat);
> var dist = SWpoint.distanceTo(NEpoint);
> alert(dist);
>
> The variable "dist" does seem to have a value but I do not know what it is.
> It returned value is not large enough to be miles or meters so I am not sure
> if I am using it incorrectly or this is not how I would get the distance
> between two geocoords.
>
> Thoughs?
Most like it is the cartesian distance of the lat and long values. So it
is probably degrees. If the points are close to one another then you can
convert it to miles = answer * 60 * 1.1508.
-Steve
More information about the Users
mailing list