From: Paul Ramsey Date: Mon, 16 Nov 2009 19:10:14 +0000 (+0000) Subject: Make an unknown geography SRID translate to a 4326 geometry SRID during a cast (... X-Git-Tag: 1.5.0b1~227 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8df120e6642a777562aeca865261da33d932382e;p=postgis Make an unknown geography SRID translate to a 4326 geometry SRID during a cast (#298) git-svn-id: http://svn.osgeo.org/postgis/trunk@4835 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c index 67190f165..c535ffedb 100644 --- a/postgis/geography_inout.c +++ b/postgis/geography_inout.c @@ -948,6 +948,12 @@ Datum geometry_from_geography(PG_FUNCTION_ARGS) GSERIALIZED *g_ser = (GSERIALIZED*)PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); lwgeom = lwgeom_from_gserialized(g_ser); + + /* We want "geometry" to think all our "geography" has an SRID, and the + implied SRID is 4326, so we fill that in if our SRID is actually unknown. */ + if( lwgeom->SRID == -1 ) + lwgeom->SRID = 4326; + ret = pglwgeom_serialize(lwgeom); lwgeom_release(lwgeom);