[postgis-users] Error using pgsql2shp

strk at refractions.net strk at refractions.net
Fri Jun 16 15:07:44 PDT 2006


On Fri, Jun 16, 2006 at 08:51:19AM -0600, Bruce Rindahl wrote:
> v1.83 works fine, 1.84 and 1.85 gives the error.  Do you have a diff from
> 1.83 so I can test if it is the compiler?

Not much has changed between the two versions:

cvs diff -r 1.83 -r 1.84 pgsql2shp.c

Index: pgsql2shp.c
===================================================================
RCS file: /home/cvs/postgis/postgis/loader/pgsql2shp.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -U2 -r1.83 -r1.84
--- pgsql2shp.c 3 Feb 2006 20:53:36 -0000       1.83
+++ pgsql2shp.c 18 Apr 2006 14:09:28 -0000      1.84
@@ -1,4 +1,4 @@
 /**********************************************************************
- * $Id: pgsql2shp.c,v 1.83 2006/02/03 20:53:36 strk Exp $
+ * $Id: pgsql2shp.c,v 1.84 2006/04/18 14:09:28 strk Exp $
  *
  * PostGIS - Spatial Types for PostgreSQL
@@ -20,5 +20,5 @@

 static char rcsid[] =
-  "$Id: pgsql2shp.c,v 1.83 2006/02/03 20:53:36 strk Exp $";
+  "$Id: pgsql2shp.c,v 1.84 2006/04/18 14:09:28 strk Exp $";

 #include <stdio.h>
@@ -59,4 +59,8 @@
 #define HEXWKB 1

+/* Maximum DBF field width (according to ARCGIS) */
+#define MAX_DBF_FIELD_SIZE 255
+
+
 /*typedef unsigned long int uint32;*/
 typedef uint32_t uint32;
@@ -2773,10 +2777,20 @@
                        }
                }
+
+               if ( size > MAX_DBF_FIELD_SIZE )
+               {
+                       fprintf(stderr, "Warning: values of field '%s' "
+                               "exceeding maximum dbf field width (%d) "
+                               "will be truncated.\n",
+                               fname, MAX_DBF_FIELD_SIZE);
+                       size = MAX_DBF_FIELD_SIZE;
+               }
+
 /*printf( "FIELD_NAME: %s, SIZE: %d\n", field_name, size); */
-
+
                /* generic type (use string representation) */
                if(DBFAddField(dbf, field_name, FTString, size, 0) == -1)
                {
-                       printf( "Error - String field could not "
+                       fprintf(stderr, "Error - String field could not "
                                        "be created.\n");
                        return 0;



More information about the postgis-users mailing list