Definition at line 75 of file shp2pgsql-cli.c.
References shp_loader_config::column_map_filename, shp_loader_state::config, shp_loader_config::createindex, shp_loader_config::dump_format, shp_loader_config::encoding, shp_loader_config::force_output, FORCE_OUTPUT_2D, FORCE_OUTPUT_3DM, FORCE_OUTPUT_3DZ, FORCE_OUTPUT_4D, shp_loader_config::forceint4, free(), shp_loader_config::geo_col, shp_loader_config::geography, shp_loader_config::idxtablespace, malloc(), shp_loader_state::message, shp_loader_config::null_policy, shp_loader_config::opt, shp_loader_state::pgdims, pgis_getopt(), pgis_optarg, pgis_optind, shp_loader_state::pgtype, POLICY_NULL_ABORT, POLICY_NULL_INSERT, POLICY_NULL_SKIP, shp_loader_config::quoteidentifiers, shp_loader_config::readshape, shp_loader_config::schema, set_loader_config_defaults(), shp_loader_config::shp_file, shp_loader_config::shp_sr_id, shp_loader_state::shpfiletype, ShpLoaderCreate(), ShpLoaderDestroy(), SHPLOADERERR, ShpLoaderGenerateSQLRowStatement(), ShpLoaderGetRecordCount(), ShpLoaderGetSQLCopyStatement(), ShpLoaderGetSQLFooter(), ShpLoaderGetSQLHeader(), SHPLOADEROK, ShpLoaderOpenShape(), SHPLOADERRECDELETED, SHPLOADERRECISNULL, SHPLOADERWARN, SHPTypeName(), shp_loader_config::simple_geometries, shp_loader_config::sr_id, SRID_UNKNOWN, strtolower(), shp_loader_config::table, shp_loader_config::tablespace, usage(), shp_loader_config::use_wkt, and shp_loader_config::usetransaction.
79 char *header, *footer, *record;
84 setlocale (LC_ALL,
"");
85 bindtextdomain (PACKAGE, PGSQL_LOCALEDIR);
101 while ((c =
pgis_getopt(argc, argv,
"-acdeg:ikm:nps:t:wDGIN:ST:W:X:")) != EOF)
136 sscanf(ptr,
"%d", &config->
sr_id);
147 fprintf(stderr,
"The -s parameter must be specified in the form [FROM_SRID:]TO_SRID\n");
195 fprintf(stderr,
"Unsupported NULL geometry handling policy.\nValid policies: insert, skip, abort\n");
219 fprintf(stderr,
"Unsupported output type: %s\nValid output types are 2D, 3DZ, 3DM and 4D\n",
pgis_optarg);
249 fprintf(stderr,
"Invalid argument combination - cannot use both -D and -e\n");
255 fprintf(stderr,
"Invalid argument combination - cannot use -D with -s FROM_SRID:TO_SRID\n");
275 char *chrptr = strchr(strptr,
'.');
280 if ( chrptr == strptr )
289 config->
schema = strdup(strptr);
290 config->
table = strdup(chrptr+1);
294 config->
table = strdup(strptr);
302 char *shp_file = strdup(config->
shp_file);
306 for ( ptr = shp_file + strlen(shp_file); ptr > shp_file; ptr-- )
316 for ( ptr = shp_file + strlen(shp_file); ptr > shp_file; ptr-- )
318 if ( *ptr ==
'/' || *ptr ==
'\\' )
324 config->
table = strdup(ptr);
345 fprintf(stderr,
"%s\n", state->
message);
355 fprintf(stderr,
"Postgis type: %s[%d]\n", state->
pgtype, state->
pgdims);
362 fprintf(stderr,
"%s\n", state->
message);
368 printf(
"%s", header);
381 fprintf(stderr,
"%s\n", state->
message);
387 printf(
"%s", header);
400 printf(
"%s\n", record);
406 fprintf(stderr,
"%s\n", state->
message);
412 fprintf(stderr,
"%s\n", state->
message);
413 printf(
"%s\n", record);
437 fprintf(stderr,
"%s\n", state->
message);
443 printf(
"%s", footer);
int ShpLoaderGetSQLFooter(SHPLOADERSTATE *state, char **strfooter)
char * column_map_filename
int ShpLoaderOpenShape(SHPLOADERSTATE *state)
#define POLICY_NULL_INSERT
#define SHPLOADERRECISNULL
#define SHPLOADERRECDELETED
int ShpLoaderGetSQLHeader(SHPLOADERSTATE *state, char **strheader)
void ShpLoaderDestroy(SHPLOADERSTATE *state)
#define POLICY_NULL_ABORT
void set_loader_config_defaults(SHPLOADERCONFIG *config)
int ShpLoaderGetRecordCount(SHPLOADERSTATE *state)
#define SRID_UNKNOWN
Unknown SRID value.
SHPLOADERSTATE * ShpLoaderCreate(SHPLOADERCONFIG *config)
const char SHPAPI_CALL1 * SHPTypeName(int nSHPType);const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType
char message[SHPLOADERMSGLEN]
int ShpLoaderGetSQLCopyStatement(SHPLOADERSTATE *state, char **strheader)
int ShpLoaderGenerateSQLRowStatement(SHPLOADERSTATE *state, int item, char **strrecord)
int pgis_getopt(int argc, char **argv, char *opts)