[postgis-users] Patch for casting geometry to geography

Marshall, Steve smarshall at wsi.com
Thu Jan 20 12:28:46 PST 2011


Related to an earlier post by Radu Ilie, I have a patch for casting from 
geometry to geography that solves his problem.  In particular, it will 
transform coordinates into the desired range for geography objects (-90 
to 90 lat, -180 to 180 lon).  The previous version detected this 
problem, but simply issued an error if it occurred.

The attached files add one new external function to the the postgis 
library (lwgeom_force_geodetic) and uses it in the function that casts 
geometry objects to geography objects (Datum geography_in).  The logic 
is a very simple clone of the lwgeom_check_geodetic function, except it 
fixes any descrepancies it finds.

I hope this could be included in a future PostGIS release.  If 
necessary, I can post this to a different list.

Steve Marshall
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geography_cast_patch.tar.gz
Type: application/x-gzip
Size: 1868 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110120/f20b0afb/attachment.bin>


More information about the postgis-users mailing list