]> granicus.if.org Git - postgis/commitdiff
Dropped initial scan of shapefile - we don't check for all-null geometries anymore...
authorSandro Santilli <strk@keybit.net>
Tue, 1 Nov 2005 11:53:18 +0000 (11:53 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 1 Nov 2005 11:53:18 +0000 (11:53 +0000)
git-svn-id: http://svn.osgeo.org/postgis/branches/pgis_1_0@2017 b70326c6-7e19-0410-871a-916f4a2858ee

CHANGES
loader/shp2pgsql.c

diff --git a/CHANGES b/CHANGES
index 97680c3ec38fa9bd1be725539c642b521b1aeec2..9ad75b7d1bec3b369e3cd8482a3c94ebe9ad83f1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,7 @@ PostGIS 1.0.5CVS
        - Fixed return code of shp2pgsql
        - Fixed handling of trailing dots in dbf numerical attributes
        - Schema aware postgis_proc_upgrade.pl, support for pgsql 7.2.1
+       - Fixed back-compatibility issue in loader (load of null shapefiles)
 
 PostGIS 1.0.4
 2005/09/09
index 2900ee8197ee6aa5993b68a43a6fac3631392d82..5f520b3bebe851254a78b7dd03a63fc5d807d6e7 100644 (file)
@@ -430,9 +430,6 @@ Cleanup(void)
 void
 OpenShape(void)
 {
-       int j;
-       SHPObject *obj=NULL;
-
        hSHPHandle = SHPOpen( shp_file, "rb" );
        if (hSHPHandle == NULL) {
                fprintf(stderr, "%s: shape (.shp) or index files (.shx) can not be opened.\n", shp_file);
@@ -445,26 +442,6 @@ OpenShape(void)
                exit(-1);
        }
        SHPGetInfo(hSHPHandle, &num_entities, &shpfiletype, NULL, NULL);
-
-       /* Check we have at least a not-null geometry */
-       for (j=0; j<num_entities; j++)
-       {
-               obj = SHPReadObject(hSHPHandle,j);
-               if ( obj && obj->nVertices > 0 ) {
-                       SHPDestroyObject(obj);
-                       break;
-               }
-               SHPDestroyObject(obj);
-               obj=NULL;
-       }
-
-       if ( obj == NULL) 
-       {
-               fprintf(stderr, "Shapefile contains %d NULL object(s)\n",
-                       num_entities);
-               exit(-1);
-       }
-
 }
 
 /*
@@ -639,6 +616,10 @@ LoadData(void)
 
                //open the next object
                obj = SHPReadObject(hSHPHandle,j);
+               if ( ! obj ) {
+                       fprintf(stderr, "Error reading shape\n");
+                       exit(1);
+               }
 
                if (!dump_format)
                {
@@ -1661,6 +1642,9 @@ utf8 (const char *fromcode, char *inputbuf)
 
 /**********************************************************************
  * $Log$
+ * Revision 1.88.2.14  2005/11/01 11:53:18  strk
+ * Dropped initial scan of shapefile - we don't check for all-null geometries anymore. Added check of return from SHPReadObject
+ *
  * Revision 1.88.2.13  2005/10/24 16:12:41  strk
  * Reverted backport of stricter INTEGER and STRING attributes handling.
  * The change is too big to appear in the 1.0 branch.