[postgis-users] distance between two POINTM

Paul Ramsey pramsey at refractions.net
Mon May 14 07:31:24 PDT 2007


It will just factor in the extra 3D distance along the hypotenuse  
between the two points, it won't factor in the extra 2km of distance  
from the center of the earth, or any up-and-down that is not captured  
in the data.  If you load the whole GPS track in, and do that,  
instead of just the terminal points, you'll get something pretty damn  
close to "reality" though.

P

On 13-May-07, at 11:28 PM, Matthew Perry wrote:

> Also, length3d_spheroid might be of interest.
>
> - matt
>
> On 5/13/07, Matthew Perry <perrygeo at gmail.com> wrote:
>> Michael,
>>
>> On 5/13/07, Michael Welter <mike at telecommatters.net> wrote:
>> > 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.
>> >
>>
>> This is correct if you consider that distance_sphere (and
>> distance_spheroid) are calculating linear distance along a fixed,
>> mathematically-defined surface. The elevation doesn't factor into the
>> calculation.
>>
>> For a true on-the-ground distance between two points, you'd have to
>> get do an elevation profile on a DEM. WIth the 2D distance between
>> each node and the change in elevation, you could do some trigonometry
>> to determine the 3D length of each segment and sum the results.  
>> Take a
>> look at GRASS, specifically r.profile
>> (http://grass.itc.it/gdp/html_grass63/r.profile.html)
>>
>>
>> --
>> Matthew T. Perry
>> http://www.perrygeo.net
>>
>> "You never change things by fighting the existing reality.
>> To change something, build a new model that makes
>> the existing model obsolete" - R. Buckminster Fuller
>>
>
>
> -- 
> Matthew T. Perry
> http://www.perrygeo.net
>
> "You never change things by fighting the existing reality.
> To change something, build a new model that makes
> the existing model obsolete" - R. Buckminster Fuller
> _______________________________________________
> 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