[postgis-users] distance between two points and elevation
nicklas.aven at jordogskog.no
nicklas.aven at jordogskog.no
Wed Mar 11 06:54:55 PDT 2009
Hallo
If you are just working with distances of 1/4 of a mile I guess it would be easier to work in meters.
If you have a srid with the unit meters you could do something like this I guess
select st_Z(a.the_geom)-st_Z(b.the_geom) from (select user_input_point) a, (select the_geom from the_point_dataset) b
where st_dwithin(a.the_geom,b.the_geom,400(or the exact number in meters of 1/4 of a mile))
I don't know if st_dwithin consider the third dimension or just calculate from 2d
Hope this helps
Nicklas
2009-03-10 MWilson Matthew wrote:
>
Good evening,
Im a total postGIS newbie and Ive done some searching but I havent found an answer yet.
Ive found and tried using the st_distance_spheroid function, and that seems to return a result as I would expect. However, I have a project where my goal is to determine what points fall within ¼ mile of a point that a user would specify as well as determining the elevation difference to the selected points from the user specified point.
Ive defined my geometry field with the Z value that weve pre-calculated, and that seems to show up properly when looking at the values using the st_AsEWKT function.
I was initially thinking I would have to generate a line object for the two points in question using ST_Makeline, use that distance with the st_length3d_spheroid function to compare with the 2d distance returned by st_distance_spheroid and calculate for the other side of the triangle to get the elevation difference, but that doesnt seem to match the elevation numbers I have.
I did have to transform everything into latlong to get the distance functions to workbut I have a feeling that Im over thinking this. There should be some kind of function to return the Z value difference between two geometries right?
Could someone please point me in that direction?
Thanks,
Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090311/2fe18d58/attachment.html>
More information about the postgis-users
mailing list