]> granicus.if.org Git - postgis/commitdiff
Make an unknown geography SRID translate to a 4326 geometry SRID during a cast (...
authorPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 16 Nov 2009 19:10:14 +0000 (19:10 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 16 Nov 2009 19:10:14 +0000 (19:10 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@4835 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/geography_inout.c

index 67190f16584de0acf0a2e9370102610a06935902..c535ffedb8a610df6ae6eff143032873f46be911 100644 (file)
@@ -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);