Definition at line 839 of file shp2pgsql-core.c.
References _, codepage2encoding(), shp_loader_state::col_names, COLLECTIONTYPE, colmap_pg_by_dbf(), colmap_read(), shp_loader_state::column_map, shp_loader_config::column_map_filename, shp_loader_state::config, DBFGetFieldCount(), DBFGetFieldInfo(), DBFGetRecordCount(), DBFOpen(), shp_loader_config::encoding, ENCODING_DEFAULT, shp_loader_state::field_names, shp_loader_config::force_output, FORCE_OUTPUT_2D, FORCE_OUTPUT_3DM, FORCE_OUTPUT_3DZ, FORCE_OUTPUT_4D, shp_loader_config::forceint4, free(), shp_loader_state::geo_col, shp_loader_state::has_m, shp_loader_state::has_z, shp_loader_state::hDBFHandle, shp_loader_state::hSHPHandle, lwfree(), malloc(), MAXFIELDNAMELEN, shp_loader_state::message, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, shp_loader_config::null_policy, shp_loader_state::num_entities, shp_loader_state::num_fields, shp_loader_state::num_records, SHPObject::nVertices, shp_loader_state::pgdims, shp_loader_state::pgfieldtypes, shp_loader_state::pgtype, POINTTYPE, POLICY_NULL_ABORT, shp_loader_state::precisions, shp_loader_config::quoteidentifiers, shp_loader_config::readshape, shp_loader_config::shp_file, SHPDestroyObject(), shp_loader_state::shpfiletype, SHPGetInfo(), SHPLOADERERR, SHPLOADERMSGLEN, SHPLOADEROK, SHPLOADERWARN, SHPOpen(), SHPReadObject(), SHPT_ARC, SHPT_ARCM, SHPT_ARCZ, SHPT_MULTIPOINT, SHPT_MULTIPOINTM, SHPT_MULTIPOINTZ, SHPT_POINT, SHPT_POINTM, SHPT_POINTZ, SHPT_POLYGON, SHPT_POLYGONM, SHPT_POLYGONZ, shp_loader_config::simple_geometries, strtolower(), ovdump::type, shp_loader_state::types, utf8(), UTF8_BAD_RESULT, UTF8_GOOD_RESULT, UTF8_NO_RESULT, shp_loader_state::widths, and struct_point::z.
Referenced by main(), pgui_action_import(), and validate_remote_loader_columns().
845 int field_precision, field_width;
848 DBFFieldType
type = -1;
890 char *newencoding = NULL;
941 state->
pgtype =
"MULTILINESTRING";
948 state->
pgtype =
"MULTIPOLYGON";
955 state->
pgtype =
"MULTIPOINT";
972 state->
pgtype =
"MULTILINESTRINGM";
980 state->
pgtype =
"MULTIPOLYGONM";
988 state->
pgtype =
"MULTIPOINTM";
1003 state->
pgtype =
"MULTILINESTRING";
1012 state->
pgtype =
"MULTIPOLYGON";
1021 state->
pgtype =
"MULTIPOINT";
1029 state->
pgtype =
"GEOMETRY";
1112 state->
widths[j] = field_width;
1118 char *encoding_msg =
_(
"Try \"LATIN1\" (Western European), or one of the values described at http://www.gnu.org/software/libiconv/.");
1125 snprintf(state->
message,
SHPLOADERMSGLEN,
_(
"Unable to convert field name \"%s\" to UTF-8 (iconv reports \"%s\"). Current encoding is \"%s\". %s"), utf8str, strerror(errno), state->
config->
encoding, encoding_msg);
1127 snprintf(state->
message,
SHPLOADERMSGLEN,
_(
"Unable to convert field name to UTF-8 (iconv reports \"%s\"). Current encoding is \"%s\". %s"), strerror(errno), state->
config->
encoding, encoding_msg);
1164 if (name[0] ==
'_' ||
1165 ! strcmp(name,
"gid") || ! strcmp(name,
"tableoid") ||
1166 ! strcmp(name,
"cmin") ||
1167 ! strcmp(name,
"cmax") ||
1168 ! strcmp(name,
"xmin") ||
1169 ! strcmp(name,
"xmax") ||
1170 ! strcmp(name,
"primary") ||
1171 ! strcmp(name,
"oid") || ! strcmp(name,
"ctid"))
1176 strcpy(name, name2);
1180 for (z = 0; z < j ; z++)
1193 switch (state->
types[j])
1209 else if (state->
widths[j] >=10 && state->
widths[j] < 19)
1213 else if (state->
widths[j] < 5)
1225 fprintf(stderr,
"Field %s is an FTDouble with width %d and precision %d\n",
1227 if (state->
widths[j] > 18)
char * column_map_filename
int colmap_read(const char *filename, colmap *map, char *errbuf, size_t errbuflen)
Read the content of filename into a symbol map.
char * codepage2encoding(const char *cpg)
void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject)
int SHPAPI_CALL DBFGetRecordCount(DBFHandle psDBF)
void SHPAPI_CALL SHPGetInfo(SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
#define POLICY_NULL_ABORT
SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile, const char *pszAccess)
DBFFieldType SHPAPI_CALL DBFGetFieldInfo(DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF)
DBFHandle SHPAPI_CALL DBFOpen(const char *pszFilename, const char *pszAccess)
SHPObject SHPAPI_CALL1 * SHPReadObject(SHPHandle hSHP, int iShape);int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape, SHPObject *psObject
char message[SHPLOADERMSGLEN]
static int utf8(const char *fromcode, char *inputbuf, char **outputbuf)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
const char * colmap_pg_by_dbf(colmap *map, const char *dbfname)