[postgis-users] Distance between two points !

Stephen Woodbridge woodbri at swoodbridge.com
Fri Jul 6 04:45:05 PDT 2007


Try distance_sphere()

Fabio Rillo wrote:
> 
> 
> Hi
> 
> I’m a newbie to PostGIS and I have same problem with function 
> distance(geometry, geometry). I need to know the distance between two 
> points IN METERS but distance return a number that represent the 
> distance into carthesian system but I don’t know how convert this number 
> in meters… Or there is another war to do this!?!
> 
>  
> 
> PS.
> 
> I use geoserver to show maps and works very well…
> 
> This is a my example query:
> 
>  
> 
> select
> 
> distance(
> 
>           geomfromtext('POINT(14.7926950454712 41.1229515075684)', 4236),
> 
>           geomfromtext('POINT(14.7931413650513 41.1228904724121)', 4236)
> 
>     );
> 
> Return 0,000450473592882729 !?!!?
> 
>  
> 
>  
> 
> Since SRID 4236 has UNIT["degree",…] I tried to use the “transform” 
> function in this way:
> 
>  
> 
> select  distance(
> 
>           transform(PointFromText('POINT(14.7926950454712 
> 41.1229515075684)', 4236), 26986),
> 
>           transform(PointFromText('POINT(14.7931413650513 
> 41.1228904724121)', 4236), 26986)
> 
>           );
> 
>  
> 
> Because SRID 26986 has UNIT["metre"…]
> 
>  
> 
>  
> 
> But I didn’t solve the problem.
> 
>  
> 
> Thanks Fabio
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list