22 #include "../postgis_config.h"
35 #include <sys/param.h>
38 #include "../liblwgeom/stringbuffer.h"
39 #include "../liblwgeom/liblwgeom.h"
40 #include "../liblwgeom/lwgeom_log.h"
43 #define MAX_DBF_FIELD_SIZE 254
47 static int reverse_points(
int num_points,
double *
x,
double *
y,
double *z,
double *m);
48 static int is_clockwise(
int num_points,
double *
x,
double *
y,
double *z);
77 err = vasprintf(&
value, format, ap);
88 const uint8_t ndr_nan[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f};
91 memcpy(&double_nan, ndr_nan, 8);
102 double *xpts, *ypts, *zpts, *mpts;
105 xpts =
malloc(
sizeof(
double));
106 ypts =
malloc(
sizeof(
double));
107 zpts =
malloc(
sizeof(
double));
108 mpts =
malloc(
sizeof(
double));
119 LWDEBUGF(4,
"Point: %g %g %g %g", xpts[0], ypts[0], zpts[0], mpts[0]);
138 double *xpts, *ypts, *zpts, *mpts;
148 for (i = 0; i < lwmultipoint->
ngeoms; i++)
157 LWDEBUGF(4,
"MultiPoint %d - Point: %g %g %g %g", i, xpts[i], ypts[i], zpts[i], mpts[i]);
177 double *xpts, *ypts, *zpts, *mpts;
179 int *shpparts, shppointtotal = 0, shppoint = 0;
185 for (i = 0; i < lwpolygon->
nrings; i++)
189 xpts =
malloc(
sizeof(
double) * shppointtotal);
190 ypts =
malloc(
sizeof(
double) * shppointtotal);
191 zpts =
malloc(
sizeof(
double) * shppointtotal);
192 mpts =
malloc(
sizeof(
double) * shppointtotal);
194 LWDEBUGF(4,
"Total number of points: %d", shppointtotal);
197 for (i = 0; i < lwpolygon->
nrings; i++)
200 shpparts[i] = shppoint;
206 xpts[shppoint] = p4d.
x;
207 ypts[shppoint] = p4d.
y;
208 zpts[shppoint] = p4d.
z;
209 mpts[shppoint] = p4d.
m;
211 LWDEBUGF(4,
"Polygon Ring %d - Point: %g %g %g %g", i, xpts[shppoint], ypts[shppoint], zpts[shppoint], mpts[shppoint]);
224 &xpts[shpparts[i]], &ypts[shpparts[i]], NULL) )
226 LWDEBUG(4,
"Outer ring not clockwise, forcing clockwise\n");
229 &xpts[shpparts[i]], &ypts[shpparts[i]],
230 &zpts[shpparts[i]], &mpts[shpparts[i]]);
236 &xpts[shpparts[i]], &ypts[shpparts[i]], NULL) )
238 LWDEBUGF(4,
"Inner ring %d not counter-clockwise, forcing counter-clockwise\n", i);
241 &xpts[shpparts[i]], &ypts[shpparts[i]],
242 &zpts[shpparts[i]], &mpts[shpparts[i]]);
265 double *xpts, *ypts, *zpts, *mpts;
267 int *shpparts, shppointtotal = 0, shppoint = 0, shpringtotal = 0, shpring = 0;
272 for (i = 0; i < lwmultipolygon->
ngeoms; i++)
274 for (j = 0; j < lwmultipolygon->
geoms[i]->
nrings; j++)
282 shpparts =
malloc(
sizeof(
int) * shpringtotal);
285 xpts =
malloc(
sizeof(
double) * shppointtotal);
286 ypts =
malloc(
sizeof(
double) * shppointtotal);
287 zpts =
malloc(
sizeof(
double) * shppointtotal);
288 mpts =
malloc(
sizeof(
double) * shppointtotal);
290 LWDEBUGF(4,
"Total number of rings: %d Total number of points: %d", shpringtotal, shppointtotal);
293 for (i = 0; i < lwmultipolygon->
ngeoms; i++)
295 for (j = 0; j < lwmultipolygon->
geoms[i]->
nrings; j++)
298 shpparts[shpring] = shppoint;
300 LWDEBUGF(4,
"Ring offset: %d", shpring);
306 xpts[shppoint] = p4d.
x;
307 ypts[shppoint] = p4d.
y;
308 zpts[shppoint] = p4d.
z;
309 mpts[shppoint] = p4d.
m;
311 LWDEBUGF(4,
"MultiPolygon %d Polygon Ring %d - Point: %g %g %g %g", i, j, xpts[shppoint], ypts[shppoint], zpts[shppoint], mpts[shppoint]);
324 &xpts[shpparts[shpring]], &ypts[shpparts[shpring]], NULL) )
326 LWDEBUG(4,
"Outer ring not clockwise, forcing clockwise\n");
329 &xpts[shpparts[shpring]], &ypts[shpparts[shpring]],
330 &zpts[shpparts[shpring]], &mpts[shpparts[shpring]]);
336 &xpts[shpparts[shpring]], &ypts[shpparts[shpring]], NULL) )
338 LWDEBUGF(4,
"Inner ring %d not counter-clockwise, forcing counter-clockwise\n", i);
341 &xpts[shpparts[shpring]], &ypts[shpparts[shpring]],
342 &zpts[shpparts[shpring]], &mpts[shpparts[shpring]]);
369 double *xpts, *ypts, *zpts, *mpts;
388 LWDEBUGF(4,
"Linestring - Point: %g %g %g %g", i, xpts[i], ypts[i], zpts[i], mpts[i]);
408 double *xpts, *ypts, *zpts, *mpts;
410 int *shpparts, shppointtotal = 0, shppoint = 0;
413 shpparts =
malloc(
sizeof(
int) * lwmultilinestring->
ngeoms);
416 for (i = 0; i < lwmultilinestring->
ngeoms; i++)
419 LWDEBUGF(3,
"Total number of points: %d", shppointtotal);
422 xpts =
malloc(
sizeof(
double) * shppointtotal);
423 ypts =
malloc(
sizeof(
double) * shppointtotal);
424 zpts =
malloc(
sizeof(
double) * shppointtotal);
425 mpts =
malloc(
sizeof(
double) * shppointtotal);
428 for (i = 0; i < lwmultilinestring->
ngeoms; i++)
431 shpparts[i] = shppoint;
437 xpts[shppoint] = p4d.
x;
438 ypts[shppoint] = p4d.
y;
439 zpts[shppoint] = p4d.
z;
440 mpts[shppoint] = p4d.
m;
442 LWDEBUGF(4,
"Linestring %d - Point: %g %g %g %g", i, xpts[shppoint], ypts[shppoint], zpts[shppoint], mpts[shppoint]);
469 for (i=0; i <num_points; i++)
507 double x_change,y_change,area;
508 double *x_new, *y_new;
511 x_new = (
double *)
malloc(
sizeof(
double) * num_points);
512 y_new = (
double *)
malloc(
sizeof(
double) * num_points);
517 for (i=0; i < num_points ; i++)
519 x_new[i] =
x[i] - x_change;
520 y_new[i] =
y[i] - y_change;
523 for (i=0; i < num_points - 1; i++)
526 area += (
x[i] *
y[i+1]) - (
y[i] *
x[i+1]);
562 "select max(octet_length(\"%s\"::text)) from \"%s\".\"%s\"",
563 fname, schema, table);
569 "select max(octet_length(\"%s\"::text)) from \"%s\"",
577 if ( !
res || PQresultStatus(
res) != PGRES_TUPLES_OK )
579 printf(
_(
"Querying for maximum field length: %s"),
580 PQerrorMessage(
conn));
584 if (PQntuples(
res) <= 0 )
589 size = atoi(PQgetvalue(
res, 0, 0));
616 return "MultiPointZ";
624 return "MultiPointM";
642 return "****************";
677 buf[0] = toupper(in[0]);
702 hexewkb =
malloc(size * 2 + 1);
703 for (i=0; i<size; ++i)
deparse_hex(ewkb[i], &hexewkb[i * 2]);
704 hexewkb[size * 2] =
'\0';
719 char *pszFullname, *pszBasename;
722 char *pszFilename = state->
shp_file;
723 char *schema = state->
schema;
724 char *table = state->
table;
729 char esc_schema[1024];
730 char esc_table[1024];
731 char esc_geo_col_name[1024];
739 PQescapeStringConn(state->
conn, esc_table, table, strlen(table), &error);
740 PQescapeStringConn(state->
conn, esc_geo_col_name, geo_col_name, strlen(geo_col_name), &error);
753 PQescapeStringConn(state->
conn, esc_schema, schema, strlen(schema), &error);
755 "SELECT COALESCE((SELECT sr.srtext "
756 " FROM geometry_columns As gc INNER JOIN spatial_ref_sys sr ON sr.srid = gc.srid "
757 " WHERE gc.f_table_schema = '%s' AND gc.f_table_name = '%s' AND gc.f_geometry_column = '%s' LIMIT 1), "
758 " (SELECT CASE WHEN COUNT(DISTINCT sr.srid) > 1 THEN 'm' ELSE MAX(sr.srtext) END As srtext "
759 " FROM \"%s\".\"%s\" As g INNER JOIN spatial_ref_sys sr ON sr.srid = ST_SRID((g.\"%s\")::geometry)) , ' ') As srtext ",
760 esc_schema, esc_table, esc_geo_col_name, schema, table, geo_col_name);
765 "SELECT COALESCE((SELECT sr.srtext "
766 " FROM geometry_columns As gc INNER JOIN spatial_ref_sys sr ON sr.srid = gc.srid "
767 " WHERE gc.f_table_name = '%s' AND gc.f_geometry_column = '%s' AND pg_table_is_visible((gc.f_table_schema || '.' || gc.f_table_name)::regclass) LIMIT 1), "
768 " (SELECT CASE WHEN COUNT(DISTINCT sr.srid) > 1 THEN 'm' ELSE MAX(sr.srtext) END as srtext "
769 " FROM \"%s\" As g INNER JOIN spatial_ref_sys sr ON sr.srid = ST_SRID((g.\"%s\")::geometry)), ' ') As srtext ",
770 esc_table, esc_geo_col_name, table, geo_col_name);
775 res = PQexec(state->
conn, query);
777 if ( !
res || PQresultStatus(
res) != PGRES_TUPLES_OK )
785 for (i=0; i < PQntuples(
res); i++)
787 srtext = PQgetvalue(
res, i, 0);
788 if (strcmp(srtext,
"m") == 0)
790 snprintf(state->
message,
SHPDUMPERMSGLEN,
_(
"WARNING: Mixed set of spatial references. No prj file will be generated"));
797 if (srtext[0] ==
' ')
799 snprintf(state->
message,
SHPDUMPERMSGLEN,
_(
"WARNING: Cannot determine spatial reference (empty table or unknown spatial ref). No prj file will be generated."));
810 pszBasename = (
char *)
malloc(strlen(pszFilename)+5);
811 strcpy( pszBasename, pszFilename );
812 for ( i = strlen(pszBasename)-1;
813 i > 0 && pszBasename[i] !=
'.' && pszBasename[i] !=
'/'
814 && pszBasename[i] !=
'\\';
817 if ( pszBasename[i] ==
'.' )
818 pszBasename[i] =
'\0';
827 fp = fopen( pszFullname,
"wb" );
836 result = fputs (srtext,fp);
837 LWDEBUGF(3,
"\n result %d proj SRText is %s .\n",
result, srtext);
885 "SELECT count(1), max(ST_zmflag(\"%s\"::geometry)), geometrytype(\"%s\"::geometry) FROM \"%s\".\"%s\" GROUP BY 3",
891 "SELECT count(1), max(ST_zmflag(\"%s\"::geometry)), geometrytype(\"%s\"::geometry) FROM \"%s\" GROUP BY 3",
901 "SELECT count(1) FROM \"%s\".\"%s\"",
907 "SELECT count(1) FROM \"%s\"",
912 LWDEBUGF(3,
"Table metadata query: %s\n", query);
914 res = PQexec(state->
conn, query);
917 if (PQresultStatus(
res) != PGRES_TUPLES_OK)
925 if (PQntuples(
res) == 0)
946 int typefound = 0, typemismatch = 0;
950 for (i = 0; i < PQntuples(
res); i++)
953 if (PQgetisnull(
res, i, 2))
1016 tmpint = atoi(PQgetvalue(
res, i, 1));
1134 config->
table = NULL;
1166 state->
table = NULL;
1201 if ( ! getenv(
"PGCLIENTENCODING") )
1219 state->
conn = PQconnectdb(connstring);
1220 if (PQstatus(state->
conn) == CONNECTION_BAD)
1228 res = PQexec(state->
conn,
"SET DATESTYLE='ISO'");
1229 if (PQresultStatus(
res) != PGRES_COMMAND_OK)
1240 res = PQexec(state->
conn,
"SELECT postgis_version()");
1241 if (PQresultStatus(
res) != PGRES_TUPLES_OK)
1249 tmpvalue = PQgetvalue(
res, 0, 0);
1255 res = PQexec(state->
conn,
"SELECT oid FROM pg_type WHERE typname = 'geometry'");
1256 if (PQresultStatus(
res) != PGRES_TUPLES_OK)
1264 if (PQntuples(
res) > 0)
1266 tmpvalue = PQgetvalue(
res, 0, 0);
1280 res = PQexec(state->
conn,
"SELECT oid FROM pg_type WHERE typname = 'geography'");
1281 if (PQresultStatus(
res) != PGRES_TUPLES_OK)
1289 if (PQntuples(
res) > 0)
1292 tmpvalue = PQgetvalue(
res, 0, 0);
1311 int gidfound = 0, i, j, ret, status;
1328 "CREATE TEMP TABLE \"%s\" AS %s",
1334 if (PQresultStatus(
res) != PGRES_COMMAND_OK)
1354 "SELECT a.attname, a.atttypid, "
1355 "a.atttypmod, a.attlen FROM "
1356 "pg_attribute a, pg_class c, pg_namespace n WHERE "
1357 "n.nspname = '%s' AND a.attrelid = c.oid AND "
1358 "n.oid = c.relnamespace AND "
1359 "a.atttypid != 0 AND "
1360 "a.attnum > 0 AND c.relname = '%s'",
1367 "SELECT a.attname, a.atttypid, "
1368 "a.atttypmod, a.attlen FROM "
1369 "pg_attribute a, pg_class c WHERE "
1370 "a.attrelid = c.oid and a.attnum > 0 AND "
1371 "a.atttypid != 0 AND "
1372 "c.relname = '%s' AND "
1373 "pg_catalog.pg_table_is_visible(c.oid)",
1377 LWDEBUGF(3,
"query is: %s\n", query);
1382 if (PQresultStatus(
res) != PGRES_TUPLES_OK)
1389 if (!PQntuples(
res))
1405 if ( getenv(
"PGCLIENTENCODING") )
1436 for (i = 0; i < PQntuples(
res); i++)
1440 int pgfieldtype, pgtypmod, pgfieldlen;
1443 int dbffieldtype, dbffieldsize, dbffielddecs;
1446 pgfieldname = PQgetvalue(
res, i, 0);
1447 pgfieldtype = atoi(PQgetvalue(
res, i, 1));
1448 pgtypmod = atoi(PQgetvalue(
res, i, 2));
1449 pgfieldlen = atoi(PQgetvalue(
res, i, 3));
1480 if (!strcmp(pgfieldname,
"gid") )
1502 dbffieldname =
malloc(11);
1503 strncpy(dbffieldname, ptr, 10);
1504 dbffieldname[10] =
'\0';
1513 strncpy(dbffieldname, mapped, 10);
1514 dbffieldname[10] =
'\0';
1524 if (!strncasecmp(dbffieldname, state->
dbffieldnames[j], 10))
1526 sprintf(dbffieldname,
"%.7s_%.2d", ptr, abs(tmpint) % 100);
1536 for (nameit = 0; nameit < strlen(dbffieldname); nameit++)
1537 dbffieldname[nameit] = toupper(dbffieldname[nameit]);
1541 if (strcasecmp(dbffieldname, pgfieldname))
1543 snprintf(buf,
sizeof(buf),
_(
"Warning, field %s renamed to %s\n"), pgfieldname, dbffieldname);
1557 if (pgfieldtype == 21)
1570 else if (pgfieldtype == 23)
1583 else if (pgfieldtype == 20)
1604 else if (pgfieldtype == 700 || pgfieldtype == 701 || pgfieldtype == 1700)
1614 else if (pgfieldtype == 16)
1624 else if (pgfieldtype == 1082)
1634 else if (pgfieldtype == 1083 || pgfieldtype == 1266 || pgfieldtype == 1114 || pgfieldtype == 1184)
1647 secondsize = pgtypmod + 1;
1659 if (pgfieldtype == 1083)
1661 dbffieldsize = 8 + secondsize;
1664 else if (pgfieldtype == 1266)
1666 dbffieldsize = 8 + secondsize + 9;
1669 else if (pgfieldtype == 1114)
1671 dbffieldsize = 13 + 1 + 8 + secondsize;
1674 else if (pgfieldtype == 1184)
1676 dbffieldsize = 13 + 1 + 8 + secondsize + 9;
1686 else if (pgfieldtype == 2950)
1698 else if ((pgfieldtype == 1042 || pgfieldtype == 1043) && pgtypmod != -1)
1705 dbffieldsize = pgtypmod - 4;
1710 else if (dbffieldtype == -1)
1718 if (dbffieldsize == -1)
1736 snprintf(buf,
sizeof(buf),
_(
"Warning: values of field '%s' exceeding maximum dbf field width (%d) "
1748 LWDEBUGF(3,
"DBF FIELD_NAME: %s, SIZE: %d\n", dbffieldname, dbffieldsize);
1750 if (dbffieldtype != 9)
1753 if (
DBFAddField(state->
dbf, dbffieldname, dbffieldtype, dbffieldsize, dbffielddecs) == -1)
1755 snprintf(state->
message,
SHPDUMPERMSGLEN,
_(
"Error: field %s of type %d could not be created."), dbffieldname, dbffieldtype);
1794 snprintf(buf,
sizeof(buf),
_(
"No geometry column found.\nThe DBF file will be created but not the shx or shp files.\n"));
1857 #ifdef WORDS_BIGENDIAN
1860 "ST_asEWKB(ST_SetSRID(%s::geometry, 0), 'XDR') AS _geoX",
1866 "asbinary(%s::geometry, 'XDR') AS _geoX",
1873 "ST_AsEWKB(ST_SetSRID(%s::geometry, 0), 'NDR') AS _geoX",
1879 "asbinary(%s::geometry, 'NDR') AS _geoX",
1888 " FROM \"%s\".\"%s\"",
1913 res = PQexec(state->
conn,
"BEGIN");
1914 if (!
res || PQresultStatus(
res) != PGRES_COMMAND_OK)
1927 if (!
res || PQresultStatus(
res) != PGRES_COMMAND_OK)
1952 char *hexewkb = NULL;
1953 unsigned char *hexewkb_binary = NULL;
1959 int i, geocolnum = 0;
1977 if (PQresultStatus(state->
fetchres) != PGRES_TUPLES_OK)
1990 geocolnum = PQfnumber(state->
fetchres,
"_geoX");
2047 LWDEBUG(4,
"PostGIS >= 1.0, non-binary cursor");
2051 hexewkb_binary = PQunescapeBytea((
unsigned char *)val, &hexewkb_len);
2056 LWDEBUG(4,
"PostGIS < 1.0, non-binary cursor");
2061 hexewkb =
malloc(hexewkb_len + 1);
2062 strncpy(hexewkb, val, hexewkb_len + 1);
2067 LWDEBUG(4,
"PostGIS (any version) using binary cursor");
2074 LWDEBUGF(4,
"HexEWKB - length: %d value: %s", strlen(hexewkb), hexewkb);
2089 switch (lwgeom->
type)
2144 if (hexewkb)
free(hexewkb);
2145 if (hexewkb_binary) PQfreemem(hexewkb_binary);
2198 PQfinish(state->
conn);
char result[OUT_DOUBLE_BUFFER_SIZE]
int SHPAPI_CALL DBFAddField(DBFHandle psDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszFilename, const char *pszCodePage)
void SHPAPI_CALL DBFClose(DBFHandle psDBF)
void SHPAPI_CALL DBFSetWriteEndOfFileChar(DBFHandle psDBF, int bWriteFlag)
int SHPAPI_CALL DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, void *pValue)
void deparse_hex(uint8_t str, char *result)
Convert a char into a human readable hex digit.
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
LWGEOM * lwgeom_from_hexwkb(const char *hexwkb, const char check)
LWMPOINT * lwgeom_as_lwmpoint(const LWGEOM *lwgeom)
void lwgeom_free(LWGEOM *geom)
#define LW_PARSER_CHECK_NONE
LWMPOLY * lwgeom_as_lwmpoly(const LWGEOM *lwgeom)
int lwtype_is_collection(uint8_t type)
Determine whether a type number is a collection or not.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
int geometry_type_from_string(const char *str, uint8_t *type, int *z, int *m)
Utility function to get type number from string.
LWMLINE * lwgeom_as_lwmline(const LWGEOM *lwgeom)
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
void set_dumper_config_defaults(SHPDUMPERCONFIG *config)
static int getMaxFieldSize(PGconn *conn, char *schema, char *table, char *fname)
static SHPObject * create_polygon(SHPDUMPERSTATE *state, LWPOLY *lwpolygon)
int ShpDumperGetRecordCount(SHPDUMPERSTATE *state)
static SHPObject * create_multipolygon(SHPDUMPERSTATE *state, LWMPOLY *lwmultipolygon)
void ShpDumperDestroy(SHPDUMPERSTATE *state)
char * convert_bytes_to_hex(uint8_t *ewkb, size_t size)
Binary to hexewkb conversion function.
char * shapetypename(int num)
SHPDUMPERSTATE * ShpDumperCreate(SHPDUMPERCONFIG *config)
static SHPObject * create_linestring(SHPDUMPERSTATE *state, LWLINE *lwlinestring)
static int getTableInfo(SHPDUMPERSTATE *state)
int ShpDumperConnectDatabase(SHPDUMPERSTATE *state)
static int projFileCreate(SHPDUMPERSTATE *state)
Creates ESRI .prj file for this shp output It looks in the spatial_ref_sys table and outputs the srte...
int ShpLoaderGenerateShapeRow(SHPDUMPERSTATE *state)
static int reverse_points(int num_points, double *x, double *y, double *z, double *m)
static char * goodDBFValue(char *in, char fieldType)
Make appropriate formatting of a DBF value based on type.
static SHPObject * create_point(SHPDUMPERSTATE *state, LWPOINT *lwpoint)
int ShpDumperCloseTable(SHPDUMPERSTATE *state)
static int is_clockwise(int num_points, double *x, double *y, double *z)
char * quote_identifier(const char *s)
int ShpDumperOpenTable(SHPDUMPERSTATE *state)
static SHPObject * create_point_empty(SHPDUMPERSTATE *state, LWPOINT *lwpoint)
static char * nullDBFValue(char fieldType)
static char * core_asprintf(const char *format,...)
char * ShpDumperGetConnectionStringFromConn(SHPCONNECTIONCONFIG *conn)
#define MAX_DBF_FIELD_SIZE
static SHPObject * create_multipoint(SHPDUMPERSTATE *state, LWMPOINT *lwmultipoint)
static SHPObject * create_multilinestring(SHPDUMPERSTATE *state, LWMLINE *lwmultilinestring)
SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType)
void SHPAPI_CALL SHPClose(SHPHandle hSHP)
void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject)
SHPObject SHPAPI_CALL1 * SHPCreateObject(int nSHPType, int nShapeId, int nParts, const int *panPartStart, const int *panPartType, int nVertices, const double *padfX, const double *padfY, const double *padfZ, const double *padfM);SHPObject SHPAPI_CALL1(*) SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ
static SHPCONNECTIONCONFIG * conn
char * encoding2codepage(const char *encoding)
int colmap_read(const char *filename, colmap *map, char *errbuf, size_t errbuflen)
Read the content of filename into a symbol map.
void colmap_init(colmap *map)
const char * colmap_dbf_by_pg(colmap *map, const char *pgname)
void colmap_clean(colmap *map)
SHPObject SHPAPI_CALL1 * SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ){ return(SHPCreateObject(nSHPType, -1, 0, SHPLIB_NULLPTR, SHPLIB_NULLPTR, nVertices, padfX, padfY, padfZ, SHPLIB_NULLPTR)
int SHPAPI_CALL SHPWriteObject(SHPHandle psSHP, int nShapeId, SHPObject *psObject)
void stringbuffer_release(stringbuffer_t *s)
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
void stringbuffer_init(stringbuffer_t *s)
char * stringbuffer_getstringcopy(stringbuffer_t *s)
Returns a newly allocated string large enough to contain the current state of the string.
const char * stringbuffer_getstring(stringbuffer_t *s)
Returns a reference to the internal string being managed by the stringbuffer.
static void stringbuffer_append(stringbuffer_t *s, const char *a)
Append the specified string to the stringbuffer_t.
char * column_map_filename
SHPCONNECTIONCONFIG * conn
char message[SHPDUMPERMSGLEN]