From 8df120e6642a777562aeca865261da33d932382e Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Mon, 16 Nov 2009 19:10:14 +0000 Subject: [PATCH] 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 --- postgis/geography_inout.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- 2.50.1