Opened 14 years ago

Closed 12 years ago

Last modified 12 years ago

#657 closed task (fixed)

Spheroid/Ellipsoid projection given Lat/Lon, Distance & Bearing

Reported by: lwilmen Owned by: pramsey
Priority: low Milestone: PostGIS 2.0.3
Component: postgis Version: master
Keywords: bearing distance liblwgeom spheroid ellipsoid Cc: realityexists

Description

Feature request to expose spheroid_project() from liblwgeom as an SQL function to enable projecting from a give lat/lon by a specified heading/distance (metres).

Change History (11)

comment:1 by robe, 13 years ago

Milestone: PostGIS 1.5.3PostGIS 2.0.0

comment:2 by realityexists, 13 years ago

Cc: realityexists added

Please, please implement this for 2.0.0, along with closely related ticket 1305!

I'm currently in the process of implementing these in SQL and, being new to GIS, may waste a lot of time and not do it 100% correctly. A native PostGIS implementation would really help. This has been requested several times on the mailing list, so I think I'm not alone in needing it:

http://postgis.refractions.net/pipermail/postgis-users/2010-October/027906.html http://postgis.refractions.net/pipermail/postgis-users/2010-November/028116.html http://postgis.refractions.net/pipermail/postgis-users/2011-May/029749.html

comment:3 by pramsey, 13 years ago

Priority: mediumcritical

comment:4 by pramsey, 13 years ago

Resolution: fixed
Status: newclosed

Committed at r8495

comment:5 by realityexists, 13 years ago

Thanks! I tried out the new ST_Project function in r8577 together with ST_Azimuth. If ST_Azimuth is changed to return radians (consistent with the geometry overload) then I think ST_Project should also take a bearing in radians. Either way, would be nice to explicitly document it, eg. "The distance is given in meters and the azimuth in ...".

A few other issues:

1) ST_Project can return a point outside of the (-180,180) range, which then fails when passed to other functions, eg.

SELECT ST_Project('POINT(175 10)'::geography, 2000000, 90)

=> POINT(193.223435218359 9.50463611585127)

SELECT ST_AsText(ST_Project('POINT(175 10)'::geography, 2000000, 90))::geography

=> ERROR: Coordinate values are out of range [-180 -90, 180 90] for GEOGRAPHY type

2) SELECT ST_Distance(ST_Project('POINT(10 10)'::geography, 10, 0), 'POINT(10 10)'::geography)

=> ERROR: gbox_overlaps: cannot compare geodetic and non-geodetic boxes

3) ST_DWithin doesn't work with the returned point. SELECT ST_DWithin(ST_Project('POINT(10 10)'::geography, 2000, 90), 'POINT(10 10)'::geography, 2000)

=> false

SELECT ST_DWithin(ST_AsText(ST_Project('POINT(10 10)'::geography, 2000, 90))::geography, 'POINT(10 10)'::geography, 2000)

=> true

comment:6 by pramsey, 13 years ago

Resolution: fixed
Status: closedreopened
Version: 1.5.Xtrunk

Oops, am I exposing radians? I want to only work with degrees at a user level. Sound good? And looks like ST_Project needs to normalize the outputs before returning.

comment:7 by pramsey, 13 years ago

Resolution: fixed
Status: reopenedclosed

Should be better at r8655

comment:8 by realityexists, 13 years ago

Just noticed that the manual page for ST_Project still uses degrees in examples, even though the function now takes radians for the azimuth.

comment:9 by michischolz, 12 years ago

Priority: criticallow
Resolution: fixed
Status: closedreopened
Type: enhancementtask

Please update the documentation for ST_Project. It sais nothing about how to pass the azimuth and as said before, the example is still showing degrees instead of radians.

comment:10 by robe, 12 years ago

Milestone: PostGIS 2.0.0PostGIS 2.0.3
Resolution: fixed
Status: reopenedclosed

fixed

for PostGIS 2.1 at r11026 : http://postgis.net/docs/manual-dev/ST_Project.html

for PostGIS 2.0 at r11027 : http://postgis.net/docs/manual-2.0/ST_Project.html

The changes should update on website shortly so check back if you don't see them and let us know if it still needs further clarification.

comment:11 by robe, 12 years ago

fixed my misspelling of degrees at r11028 and r11029

Note: See TracTickets for help on using tickets.