Definition at line 842 of file shp2pgsql-core.c.
843{
848 char *utf8str;
849
850
852 {
854
856 {
859
861 }
862 }
863
864
867 {
869
871 }
872
873
874
876 {
880 }
881
882
884 {
885
887 {
888
889 char *newencoding = NULL;
891 {
894 }
895 }
896 }
897
898
900 {
902
903
905 {
906
908 {
910
911 if (!obj)
912 {
915 }
916
918 {
921 }
922
924 }
925 }
926
927
928 int geomtype = 0;
930 {
932
936 break;
937
939
940 state->
pgtype =
"MULTILINESTRING";
943 break;
944
946
947 state->
pgtype =
"MULTIPOLYGON";
950 break;
951
953
954 state->
pgtype =
"MULTIPOINT";
957 break;
958
960
965 break;
966
968
971 state->
pgtype =
"MULTILINESTRINGM";
973 break;
974
976
979 state->
pgtype =
"MULTIPOLYGONM";
981 break;
982
984
987 state->
pgtype =
"MULTIPOINTM";
989 break;
990
992
998 break;
999
1001
1002 state->
pgtype =
"MULTILINESTRING";
1007 break;
1008
1010
1011 state->
pgtype =
"MULTIPOLYGON";
1016 break;
1017
1019
1020 state->
pgtype =
"MULTIPOINT";
1025 break;
1026
1027 default:
1028 state->
pgtype =
"GEOMETRY";
1033
1036
1037 break;
1038 }
1039
1040
1042 {
1047 break;
1048
1053 break;
1054
1059 break;
1060
1065 break;
1066 default:
1067
1068 break;
1069 }
1070
1071
1073 {
1075 {
1076
1078 }
1079 }
1080
1081 }
1082 else
1083 {
1084
1086 }
1087
1088
1089
1091
1093
1094
1101
1103
1104
1105
1107 {
1108 int field_precision = 0, field_width = 0;
1110
1112 state->
widths[j] = field_width;
1114
1115
1117 {
1118 char *encoding_msg =
_(
"Try \"LATIN1\" (Western European), or one of the values described at http://www.gnu.org/software/libiconv/.");
1119
1121
1123 {
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);
1128 else
1130
1133
1135 }
1136
1140 }
1141
1142
1143
1144 {
1146 if (mapped)
1147 {
1150 }
1151 }
1152
1153
1154
1155
1156
1159
1160
1161
1162
1163
1164
1165 if (name[0] == '_' ||
1166 ! strcmp(name, "gid") ||
1167 ! strcmp(name, "tableoid") ||
1168 ! strcmp(name, "cmin") ||
1169 ! strcmp(name, "cmax") ||
1170 ! strcmp(name, "xmin") ||
1171 ! strcmp(name, "xmax") ||
1172 ! strcmp(name, "primary") ||
1173 ! strcmp(name, "oid") ||
1174 ! strcmp(name, "ctid"))
1175 {
1180 }
1181
1182
1183 for (int z = 0; z < j; z++)
1184 {
1186 {
1188 snprintf(name + strlen(name),
1190 "%i",
1191 j);
1192 break;
1193 }
1194 }
1195
1197
1198
1199 switch (state->
types[j])
1200 {
1203 break;
1204
1207 break;
1208
1210
1212 {
1214 }
1215 else if (state->
widths[j] >=10 && state->
widths[j] < 19)
1216 {
1218 }
1219 else if (state->
widths[j] < 5)
1220 {
1222 }
1223 else
1224 {
1226 }
1227 break;
1228
1230
1231 fprintf(stderr, "Field %s is an FTDouble with width %d and precision %d\n",
1233 if (state->
widths[j] > 18)
1234 {
1236 }
1237 else
1238 {
1240 }
1241 break;
1242
1245 break;
1246
1247 default:
1250 }
1251
1254
1256 {
1257
1259 }
1260 else
1261 {
1263 }
1264 }
1265
1266
1269
1270
1271 return ret;
1272}
int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF)
DBFHandle SHPAPI_CALL DBFOpen(const char *pszFilename, const char *pszAccess)
int SHPAPI_CALL DBFGetRecordCount(DBFHandle psDBF)
DBFFieldType SHPAPI_CALL DBFGetFieldInfo(DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject)
SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile, const char *pszAccess)
void SHPAPI_CALL SHPGetInfo(SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
SHPObject SHPAPI_CALL1 * SHPReadObject(SHPHandle hSHP, int iShape);int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape, SHPObject *psObject
static int utf8(const char *fromcode, char *inputbuf, char **outputbuf)
#define POLICY_NULL_ABORT
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)
const char * colmap_pg_by_dbf(colmap *map, const char *dbfname)
char * column_map_filename
char message[SHPLOADERMSGLEN]
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(), FTDate, FTDouble, FTInteger, FTInvalid, FTLogical, FTString, 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, tagSHPObject::nVertices, shp_loader_state::pgdims, shp_loader_state::pgfieldtypes, shp_loader_state::pgtype, POINTTYPE, POLICY_NULL_ABORT, shp_loader_state::precisions, DBFInfo::pszCodePage, 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(), shp_loader_state::types, utf8(), UTF8_BAD_RESULT, UTF8_GOOD_RESULT, UTF8_NO_RESULT, and shp_loader_state::widths.
Referenced by main(), pgui_action_import(), and validate_remote_loader_columns().