[OpenLayers-Users] what is the Point.distanceTo(Point) return
value??
plen
peteralen at earthlink.net
Thu Nov 29 15:01:53 EST 2007
Steve,
Thanks for the response. It appears you are correct. I tried your
calculation and it appears to be in miles now. I have a different (server
side) algorithm for calculating the distance between two points and while
both return a slightly different value, it is workable.
Thanks for your time - Peter
Stephen Woodbridge wrote:
>
> 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
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
View this message in context: http://www.nabble.com/what-is-the-Point.distanceTo%28Point%29-return-value---tf4898790.html#a14033716
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list