[postgis-commits] svn - r2760 - trunk/loader
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Wed Apr 9 12:52:19 PDT 2008
Author: pramsey
Date: 2008-04-09 12:52:19 -0700 (Wed, 09 Apr 2008)
New Revision: 2760
Modified:
trunk/loader/shp2pgsql.c
Log:
Change sr_id into an integer, per mca's suggestion.
Modified: trunk/loader/shp2pgsql.c
===================================================================
--- trunk/loader/shp2pgsql.c 2008-04-08 21:36:50 UTC (rev 2759)
+++ trunk/loader/shp2pgsql.c 2008-04-09 19:52:19 UTC (rev 2760)
@@ -96,7 +96,7 @@
char *table=NULL,*schema=NULL,*geom=NULL;
int num_fields,num_records,num_entities;
char **field_names;
-char *sr_id = NULL;
+int sr_id = 0;
/* Prototypes */
int Insert_attributes(DBFHandle hDBFHandle, int row);
@@ -579,12 +579,12 @@
/* Create the geometry column with an addgeometry call */
if ( schema )
{
- printf("SELECT AddGeometryColumn('%s','%s','%s','%s',",
+ printf("SELECT AddGeometryColumn('%s','%s','%s','%d',",
schema, table, geom, sr_id);
}
else
{
- printf("SELECT AddGeometryColumn('','%s','%s','%s',",
+ printf("SELECT AddGeometryColumn('','%s','%s','%d',",
table, geom, sr_id);
}
@@ -783,7 +783,7 @@
}
if (!dump_format) printf("'");
- if ( sr_id && strcmp(sr_id,"-1") ) printf("SRID=%s;", sr_id);
+ if ( sr_id > 0 ) printf("SRID=%d;", sr_id);
if (simple_geometries==0) // We write MULTI geometries, so generate Header
{
@@ -844,7 +844,7 @@
return;
}
- if (dump_format) printf("SRID=%s;",sr_id );
+ if (dump_format) printf("SRID=%d;",sr_id );
else printf("GeometryFromText('");
if (simple_geometries==0) // We write MULTI geometries, so generate Header
@@ -892,7 +892,7 @@
if (simple_geometries==0) printf(")");
if (dump_format) printf("\n");
- else printf("',%s) );\n",sr_id);
+ else printf("',%d) );\n",sr_id);
}
int
@@ -1066,7 +1066,7 @@
out_index = FindPolygons(obj, &Outer);
if (!dump_format) printf("'");
- if ( sr_id && strcmp(sr_id,"-1") ) printf("SRID=%s;", sr_id);
+ if ( sr_id > 0 ) printf("SRID=%d;", sr_id);
if (simple_geometries==0) // We write MULTI geometries, so generate Header
{
@@ -1137,7 +1137,7 @@
out_index = FindPolygons(obj, &Outer);
- if (dump_format) printf("SRID=%s;",sr_id );
+ if (dump_format) printf("SRID=%d;",sr_id );
else printf("GeometryFromText('");
if (simple_geometries==0) // We write MULTI geometries, so generate Header
@@ -1191,7 +1191,7 @@
if (simple_geometries==0) printf(")");
if (dump_format) printf("\n");
- else printf("',%s) );\n",sr_id);
+ else printf("',%d) );\n",sr_id);
/* Release all memory */
ReleasePolygons(Outer, out_index);
@@ -1202,7 +1202,7 @@
InsertPoint(void)
{
if (!dump_format) printf("'");
- if ( sr_id && strcmp(sr_id,"-1") ) printf("SRID=%s;", sr_id);
+ if ( sr_id > 0 ) printf("SRID=%d;", sr_id);
print_wkb_byte(getEndianByte());
print_wkb_int(wkbtype);
@@ -1219,7 +1219,7 @@
InsertPointWKT(void)
{
unsigned int u;
- if (dump_format) printf("SRID=%s;%s(", sr_id, pgtype);
+ if (dump_format) printf("SRID=%d;%s(", sr_id, pgtype);
else printf("GeometryFromText('%s(", pgtype);
for (u=0;u<obj->nVertices; u++){
@@ -1228,7 +1228,7 @@
if ( wkbtype & WKBZOFFSET ) printf(" %.15g", obj->padfZ[u]);
}
if (dump_format) printf(")\n");
- else printf(")',%s) );\n",sr_id);
+ else printf(")',%d) );\n",sr_id);
}
@@ -1240,7 +1240,7 @@
(wkbtype&WKBMOFFSET);
if (!dump_format) printf("'");
- if ( sr_id && strcmp(sr_id,"-1") ) printf("SRID=%s;", sr_id);
+ if ( sr_id > 0 ) printf("SRID=%d;", sr_id);
print_wkb_byte(getEndianByte());
print_wkb_int(wkbtype);
@@ -1306,7 +1306,7 @@
simple_geometries =1;
break;
case 's':
- sr_id = optarg;
+ (void)sscanf(optarg, "%d", &sr_id);
break;
case 'g':
geom = optarg;
@@ -1354,7 +1354,7 @@
}
}
- if ( !sr_id ) sr_id = "-1";
+ if ( !sr_id ) sr_id = -1;
if ( !geom ) geom = "the_geom";
More information about the postgis-commits
mailing list