Patch for casting geometry to geography
|Reported by:||smarshall||Owned by:||pramsey|
Related to a post by Radu Ilie on Jan 20, 2011, 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.
The API at the SQL level is not changed at all.