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