[postgis-users] distance between two POINTM

Michael Fuhr mike at fuhr.org
Tue May 15 03:01:40 PDT 2007


On Sun, May 13, 2007 at 11:53:20PM -0600, Michael Welter wrote:
> You're doing some great research, Michael.  How did you get the CDOT data?

http://www.dot.state.co.us/app_DTD_DataAccess/GeoData/index.cfm?fuseaction=GeoDataMain&MenuType=GeoData

I used "Highways" under "Statewide Data Set."  The SRID is 26913
(NAD83 / UTM zone 13N).

> But here's my original question:  What is the proper method to calculate 
> distance on the earth's surface?
[...]
> The distance returned from problem #1 (~2500m elevation) should be 
> greater that from problem #2 (sea level).   However, it appears that the 
> Z value is ignored altogether.

Matthew and Paul have followed up to this; I don't know enough to
add much else.

The second of the following examples uses a spheroid with a semi-major
axis 2500m greater than the first.  I don't know if this is a proper
test but it shows a difference of less than 2m.

select distance_spheroid(GeomFromEWKT('SRID=4269;POINT(-105.32395 39.50163)'),
                         GeomFromEWKT('SRID=4269;POINT(-105.30166 39.53806)'),
                         'SPHEROID["GRS 1980",6378137,298.257222101]');
 distance_spheroid 
-------------------
  4475.81916645913
(1 row)

select distance_spheroid(GeomFromEWKT('SRID=4269;POINT(-105.32395 39.50163)'),
                         GeomFromEWKT('SRID=4269;POINT(-105.30166 39.53806)'),
                         'SPHEROID["GRS 1980",6380637,298.257222101]');
 distance_spheroid 
-------------------
  4477.57352637899
(1 row)

-- 
Michael Fuhr



More information about the postgis-users mailing list