From: Paul Ramsey Date: Sat, 31 Oct 2009 00:10:37 +0000 (+0000) Subject: Tighten up geometry->geography case (#265) X-Git-Tag: 1.5.0b1~319 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ebc19152b6d37ad6b3b514be2326991ede7fa6cc;p=postgis Tighten up geometry->geography case (#265) git-svn-id: http://svn.osgeo.org/postgis/trunk@4711 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c index 481ab135a..67190f165 100644 --- a/postgis/geography_inout.c +++ b/postgis/geography_inout.c @@ -908,10 +908,17 @@ Datum geography_from_geometry(PG_FUNCTION_ARGS) lwgeom = lwgeom_deserialize(lwgeom_serialized); + if( ! ( lwgeom->SRID == 4326 || lwgeom->SRID == -1 ) ) + { + ereport(ERROR, ( + errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("Only SRID 4326 or unknown (-1) are currently supported in geography." ))); + } + /* ** Serialize our lwgeom and set the geodetic flag so subsequent ** functions do the right thing. - */ + */ g_ser = geography_serialize(lwgeom); FLAGS_SET_GEODETIC(g_ser->flags, 1);