[Mapserver-users] distance from lat-long
Jerl Simpson
jerl.simpson at rkiq.com
Tue May 18 13:57:31 PDT 2004
Changqing,
Using PHP, this seems to work well for me. It's not completely precise,
but it's pretty close for small areas.
$A=abs($Lat1-$Lat2)*111195;
$B=abs($Lon1-$Lon2)*111195*cos(deg2rad(($Lat1+$Lat2)/2));
$C=sqrt($A*$A + $B*$B); // gives distance in meters between two points
Jerl
Changqing Zhou wrote:
> Hi, I feel I am really asking a stupid question here. So please just
> discard if it makes you laugh.
>
> I have a pair of lat-long. My assumption is that my area is very small,
> like in a city.
>
> 1)Is there a simple equation I can use to calculate the distance in
> meters of those two points?
>
> 2)If I do d = sqrt [ sqr(p1.lat - p2.lat) + sqr(p1.long - p2.long)], does
> d mean anything at all?
>
> Thanks,
>
> Changqing
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> .
>
More information about the MapServer-users
mailing list