]> granicus.if.org Git - postgis/commitdiff
Properly convert typed empties coming from GEOS.
authorSandro Santilli <strk@keybit.net>
Fri, 1 Jul 2011 10:10:27 +0000 (10:10 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 1 Jul 2011 10:10:27 +0000 (10:10 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7536 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_geos.c
regress/tickets_expected

index 7afcd4407890b712cc0eeb776225f47f7dc71d2c..2ff63e0250b94cfa409289871c86cb8e9fa38e11 100644 (file)
@@ -3787,18 +3787,16 @@ GEOS2LWGEOM(const GEOSGeometry *geom, char want3d)
        case GEOS_POINT:
                POSTGIS_DEBUG(4, "lwgeom_from_geometry: it's a Point");
                cs = GEOSGeom_getCoordSeq(geom);
-/* FIXME: dunno how to represent an empty point */
-if ( GEOSisEmpty(geom) )
-       return (LWGEOM*)lwcollection_construct_empty(COLLECTIONTYPE, SRID, want3d, 0);
+               if ( GEOSisEmpty(geom) )
+                 return (LWGEOM*)lwpoint_construct_empty(SRID, want3d, 0);
                pa = ptarray_from_GEOSCoordSeq(cs, want3d);
                return (LWGEOM *)lwpoint_construct(SRID, NULL, pa);
 
        case GEOS_LINESTRING:
        case GEOS_LINEARRING:
                POSTGIS_DEBUG(4, "lwgeom_from_geometry: it's a LineString or LinearRing");
-/* FIXME: dunno how to represent an empty linestring */
-if ( GEOSisEmpty(geom) )
-       return (LWGEOM*)lwcollection_construct_empty(COLLECTIONTYPE, SRID, want3d, 0);
+               if ( GEOSisEmpty(geom) )
+                 return (LWGEOM*)lwline_construct_empty(SRID, want3d, 0);
 
                cs = GEOSGeom_getCoordSeq(geom);
                pa = ptarray_from_GEOSCoordSeq(cs, want3d);
@@ -3806,10 +3804,8 @@ if ( GEOSisEmpty(geom) )
 
        case GEOS_POLYGON:
                POSTGIS_DEBUG(4, "lwgeom_from_geometry: it's a Polygon");
-
-/* FIXME: dunno how to represent an empty polygon */
-if ( GEOSisEmpty(geom) )
-       return (LWGEOM*)lwcollection_construct_empty(COLLECTIONTYPE, SRID, want3d, 0);
+               if ( GEOSisEmpty(geom) )
+                 return (LWGEOM*)lwpoly_construct_empty(SRID, want3d, 0);
                ngeoms = GEOSGetNumInteriorRings(geom);
                ppaa = lwalloc(sizeof(POINTARRAY *)*(ngeoms+1));
                g = GEOSGetExteriorRing(geom);
index 72085d08ac4124d1ab349c5cd7d4614fc6096e7d..5c034a116e95fa1d00e80bcc98d62f72c26f5120 100644 (file)
@@ -22,7 +22,7 @@ ERROR:  Geometry argument does not have an 'M' ordinate
 #124a|COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,30 5),CIRCULARSTRING(30 5,34 56,67 89))
 ERROR:  incontinuous compound curve
 HINT:  "...0 6),CIRCULARSTRING(30 5,34 56,67 89)" <-- parse error at position 85 within geometry
-#145a|0107000020E610000000000000
+#145a|0103000020E610000000000000
 #145b|0
 #146|0|t|GEOMETRYCOLLECTION(LINESTRING(0 0,-1 -1),MULTIPOINT(1 2,2 3))
 ERROR:  Invalid hex string, length (267) has to be a multiple of two!