]> granicus.if.org Git - postgis/commitdiff
Tighten up geometry->geography case (#265)
authorPaul Ramsey <pramsey@cleverelephant.ca>
Sat, 31 Oct 2009 00:10:37 +0000 (00:10 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Sat, 31 Oct 2009 00:10:37 +0000 (00:10 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@4711 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/geography_inout.c

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