20 #include "../postgis_config.h"
22 #define xstr(s) str(s)
31 printf(
_(
"USAGE: pgsql2shp [<options>] <database> [<schema>.]<table>\n"
32 " pgsql2shp [<options>] <database> <query>\n"
35 printf(
_(
" -f <filename> Use this option to specify the name of the file to create.\n" ));
36 printf(
_(
" -h <host> Allows you to specify connection to a database on a\n"
37 " machine other than the default.\n" ));
38 printf(
_(
" -p <port> Allows you to specify a database port other than the default.\n" ));
39 printf(
_(
" -P <password> Connect to the database with the specified password.\n" ));
40 printf(
_(
" -u <user> Connect to the database as the specified user.\n" ));
41 printf(
_(
" -g <geometry_column> Specify the geometry column to be exported.\n" ));
42 printf(
_(
" -b Use a binary cursor.\n" ));
43 printf(
_(
" -r Raw mode. Do not assume table has been created by the loader. This would\n"
44 " not unescape attribute names and will not skip the 'gid' attribute.\n" ));
45 printf(
_(
" -k Keep PostgreSQL identifiers case.\n" ));
46 printf(
_(
" -m <filename> Specify a file containing a set of mappings of (long) column\n"
47 " names to 10 character DBF column names. The content of the file is one or\n"
48 " more lines of two names separated by white space and no trailing or\n"
49 " leading space. For example:\n"
50 " COLUMNNAME DBFFIELD1\n"
51 " AVERYLONGCOLUMNNAME DBFFIELD2\n" ));
52 printf(
_(
" -? Display this help screen.\n\n" ));
57 main(
int argc,
char **argv)
74 while ((c =
pgis_getopt(argc, argv,
"bf:h:du:p:P:g:rkm:")) != EOF)
144 char *chrptr = strchr(strptr,
'.');
149 if ( chrptr == strptr )
158 config->
schema = strdup(strptr);
159 config->
table = strdup(chrptr+1);
163 config->
table = strdup(strptr);
177 fprintf(stderr,
"%s\n", state->
message);
185 fprintf(stderr,
_(
"WARNING: -d switch is useless when dumping from postgis-1.0.0+\n"));
190 fprintf(stdout,
_(
"Initializing... \n"));
196 fprintf(stderr,
"%s\n", state->
message);
205 fprintf(stdout,
_(
"Dumping: "));
213 fprintf(stdout,
"X");
220 fprintf(stderr,
"%s\n", state->
message);
234 fprintf(stderr,
"%s\n", state->
message);
int pgis_getopt(int argc, char **argv, char *opts)
int main(int argc, char **argv)
static void usage(int status)
void set_dumper_config_defaults(SHPDUMPERCONFIG *config)
int ShpDumperGetRecordCount(SHPDUMPERSTATE *state)
void ShpDumperDestroy(SHPDUMPERSTATE *state)
char * shapetypename(int num)
SHPDUMPERSTATE * ShpDumperCreate(SHPDUMPERCONFIG *config)
int ShpDumperConnectDatabase(SHPDUMPERSTATE *state)
int ShpLoaderGenerateShapeRow(SHPDUMPERSTATE *state)
int ShpDumperCloseTable(SHPDUMPERSTATE *state)
int ShpDumperOpenTable(SHPDUMPERSTATE *state)
#define POSTGIS_LIB_VERSION
char * column_map_filename
SHPCONNECTIONCONFIG * conn
char message[SHPDUMPERMSGLEN]