Definition at line 846 of file shp2pgsql-core.c.
847{
852 char *utf8str;
853
854
856 {
858
860 {
863
865 }
866 }
867
868
871 {
873
875 }
876
877
878
880 {
884 }
885
886
888 {
889
891 {
892
893 char *newencoding = NULL;
895 {
898 }
899 }
900 }
901
902
904 {
906
907
909 {
910
912 {
914
915 if (!obj)
916 {
919 }
920
922 {
925 }
926
928 }
929 }
930
931
932 int geomtype = 0;
934 {
936
940 break;
941
943
944 state->
pgtype =
"MULTILINESTRING";
947 break;
948
950
951 state->
pgtype =
"MULTIPOLYGON";
954 break;
955
957
958 state->
pgtype =
"MULTIPOINT";
961 break;
962
964
969 break;
970
972
975 state->
pgtype =
"MULTILINESTRINGM";
977 break;
978
980
983 state->
pgtype =
"MULTIPOLYGONM";
985 break;
986
988
991 state->
pgtype =
"MULTIPOINTM";
993 break;
994
996
1002 break;
1003
1005
1006 state->
pgtype =
"MULTILINESTRING";
1011 break;
1012
1014
1015 state->
pgtype =
"MULTIPOLYGON";
1020 break;
1021
1023
1024 state->
pgtype =
"MULTIPOINT";
1029 break;
1030
1031 default:
1032 state->
pgtype =
"GEOMETRY";
1037
1040
1041 break;
1042 }
1043
1044
1046 {
1051 break;
1052
1057 break;
1058
1063 break;
1064
1069 break;
1070 default:
1071
1072 break;
1073 }
1074
1075
1077 {
1079 {
1080
1082 }
1083 }
1084
1085 }
1086 else
1087 {
1088
1090 }
1091
1092
1093
1095
1097
1098
1105
1107
1108
1109
1111 {
1112 int field_precision = 0, field_width = 0;
1114
1116 state->
widths[j] = field_width;
1118
1119
1121 {
1122 char *encoding_msg =
_(
"Try \"LATIN1\" (Western European), or one of the values described at http://www.gnu.org/software/libiconv/.");
1123
1125
1127 {
1129 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);
1131 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);
1132 else
1134
1137
1139 }
1140
1144 }
1145
1146
1147
1148 {
1150 if (mapped)
1151 {
1154 }
1155 }
1156
1157
1158
1159
1160
1163
1164
1165
1166
1167
1168
1169 if (name[0] == '_' ||
1170 ! strcmp(name, "gid") ||
1171 ! strcmp(name, "tableoid") ||
1172 ! strcmp(name, "cmin") ||
1173 ! strcmp(name, "cmax") ||
1174 ! strcmp(name, "xmin") ||
1175 ! strcmp(name, "xmax") ||
1176 ! strcmp(name, "primary") ||
1177 ! strcmp(name, "oid") ||
1178 ! strcmp(name, "ctid"))
1179 {
1184 }
1185
1186
1187 for (int z = 0; z < j; z++)
1188 {
1190 {
1192 snprintf(name + strlen(name),
1194 "%i",
1195 j);
1196 break;
1197 }
1198 }
1199
1201
1202
1203 switch (state->
types[j])
1204 {
1207 break;
1208
1211 break;
1212
1214
1216 {
1218 }
1219 else if (state->
widths[j] >=10 && state->
widths[j] < 19)
1220 {
1222 }
1223 else if (state->
widths[j] < 5)
1224 {
1226 }
1227 else
1228 {
1230 }
1231 break;
1232
1234
1235 fprintf(stderr, "Field %s is an FTDouble with width %d and precision %d\n",
1237 if (state->
widths[j] > 18)
1238 {
1240 }
1241 else
1242 {
1244 }
1245 break;
1246
1249 break;
1250
1251 default:
1254 }
1255
1258
1260 {
1261
1263 }
1264 else
1265 {
1267 }
1268 }
1269
1270
1273
1274
1275 return ret;
1276}
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().