[postgis-users] earth distance via projections

Jan Hartmann jhart at frw.uva.nl
Tue Apr 15 09:01:30 PDT 2003


Dave Blasby wrote:

 > There are lots of ways of doing this.  There are routines for doing
 > distance calculations on an ellipsoid, but I think its more general to
 > re-project your data.
 > ...
 > 1. Find a cartesian projection thats accurate for where your data is
 > (ie. UTM zone whatever)

There is a more general way of measuring earth distances via 
projections, (using standalone PROJ), but I don't know if this can be 
done easily within PostGIS. Some projections give true distance from one 
or two control points. An example is the "Two Points Equidistant" 
projection, which gives correct distances from its two control points to 
any other point on the map. The PROJ command (with Warsaw and Amsterdam 
as control points) would be:

proj +proj=tpeqd +lon_1=21d0 +lat_1=52d15 +lon_2=4d54 +lat_2=52d21

This PROJ command converts all input points to x/y-coordinates from 
which correct distances can be computed to either Warsaw or Amsterdam. 
This method has been used by Bell telephone to calculate costs for long 
distance calls.

Can this be done with PostGIS? PostGIS can transform coordinates using 
standard EPSG projection parameters, but can it also do transformations 
with user defined parameters, like lat/lon above?

Jan

PS: PostgreSQL's contrib directory has an "earthdistance" function, 
which computes distances over a grand circle. Does anyone know how exact 
this is, compared to a projected computation?



Pedro Salazar wrote:
> On Tue, 2003-04-15 at 15:28, Pedro Salazar wrote:
> 
>>David,
>>
> 
> 
>>2) What is the SRID for measuring the distance between geometries in
>>meters? I'm using the SRID 4326 (WGS84). So, to what system should I
>>transform my geometries to get the distance in meters?
>>
> 
> I got it. I already understood that I have to project for a UTM
> projection for example..




More information about the postgis-users mailing list