If you want to determine the distance based on an ellipsoid, you can
use the com.bbn.openmap.geo.Geo class, combined with the Length class:
Length.KM.fromRadians(geo1.distance(geo2));
or, you can also do:
geo1.distanceKM(geo2);
Cheers,
Don
On Mar 14, 2007, at 2:41 PM, Øystein E. Thorvaldsen wrote:
> Jeroen van Dijk wrote:
>> Hello,
>>
>>
>>
>> Is there a method in OpenMap to calculate the distance between two
>> LatLonPoint’s correctly (for example in kilometers)?
>>
>>
>>
>> Thanks,
> Hi,
>
> This depends on what you mean by correctly. LatLonPoint.distance
> (LatLonPoint toPoint) will return a float that represents the
> distance between the two points in radians. Use Length to convert
> to any other unit of measurement. This returned distance is not
> entirely correct, as it is based on a spherical model of the Earth.
> However, the margin of error should be about 0.5%.
>
> If you need to compute the distance more accurately than this I
> think you'll have to do it outside OpenMap.
>
> HTH,
> Øystein E. Thorvaldsen
> -- [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Mar 14 2007 - 16:18:21 EDT