[postgis-users] distance between two POINTM

Matthew Perry perrygeo at gmail.com
Sun May 13 23:28:27 PDT 2007


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



More information about the postgis-users mailing list