[postgis-users] distance between two POINTM

Michael Welter mike at telecommatters.net
Sun May 13 22:53:20 PDT 2007


You're doing some great research, Michael.  How did you get the CDOT data?

But here's my original question:  What is the proper method to calculate 
distance on the earth's surface?

Here are two problems:

select distance_sphere(GeomFromEWKT('SRID=4269;POINTM(-105.32395 
39.50163 2563)'),GeomFromEWKT('SRID=4269;POINTM(-105.30166 39.53806 
2487)'));
  distance_sphere
------------------
  4479.36511546862
(1 row)

select distance_sphere(GeomFromEWKT('SRID=4269;POINTM(-105.32395 
39.50163 0)'),GeomFromEWKT('SRID=4269;POINTM(-105.30166 39.53806 0)'));
  distance_sphere
------------------
  4479.36511546862
(1 row)

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.

Thanks,
Mike

P.S.  I'll be driving into Denver tomorrow, so I'll repeat the 
experiment on (relatively straight) I-70.





Michael Fuhr wrote:
> On Sun, May 13, 2007 at 04:15:39PM -0600, Michael Welter wrote:
>> Michael Fuhr wrote:
>>> These points appear to be along US285 in the vicinity of Conifer, CO.
>>> Might your GPS be measuring driving distance instead of straight-line
>>> distance?
>> Correct, but driving distance doesn't account for the 700m discrepancy.
> 
> Why not?  The straight-line distance from distance_sphere() is
> 4479m, or about 4.5km as you said.  But the highway between those
> points (Aspen Park and Broken Arrow Acres, right?) isn't straight,
> and when I measure the segments of US285 between the points using
> data from CDOT I get 5252m, and the segments I'm measuring extend
> slightly beyond the two points.  See the attached image: the distance
> I measured as 5252m is the highway shown in red; take out the parts
> that extend past the points and 5.2km is just about dead-on.
> 




More information about the postgis-users mailing list