-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data error in 1:10m Cultural Vectors Download version 5.0.0 #674
Comments
Thank you for the reports! Maybe the My suggestion as a workaround: try to use the ~latest
my quick test:
root@fbcd3ecfaacc:/test# ogr2ogr --version
GDAL 3.2.2, released 2021/03/05
root@fbcd3ecfaacc:/test# ogr2ogr \
-f Postgresql \
-lco DIM=2 \
-lco GEOMETRY_NAME=geometry \
-lco SCHEMA=public \
-lco precision=NO \
-nlt GEOMETRY \
-overwrite \
-progress \
-s_srs EPSG:4326 \
-t_srs EPSG:4326 \
PG:"dbname=$PGDATABASE user=$PGUSER host=$PGHOST password=$PGPASSWORD port=$PGPORT" \
"./natural-earth-vector/10m_cultural/ne_10m_admin_1_states_provinces_lakes.shp"
0...10...20...30...40...50...60...70...80...90...100 - done.
root@fbcd3ecfaacc:/test# psql
psql (14.1 (Debian 14.1-1.pgdg110+1))
Type "help" for help.
test=# \d+ ne_10m_admin_1_states_provinces_lakes
Table "public.ne_10m_admin_1_states_provinces_lakes"
+------------+-------------------------+-----------+----------+------------------------------------------------------------------------+----------+-------------+--------------+-------------+
| Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description |
+------------+-------------------------+-----------+----------+------------------------------------------------------------------------+----------+-------------+--------------+-------------+
| ogc_fid | integer | | not null | nextval('ne_10m_admin_1_states_provinces_lakes_ogc_fid_seq'::regclass) | plain | | | |
| featurecla | character varying | | | | extended | | | |
| scalerank | integer | | | | plain | | | |
| adm1_code | character varying | | | | extended | | | |
| diss_me | integer | | | | plain | | | |
| iso_3166_2 | character varying | | | | extended | | | |
| wikipedia | character varying | | | | extended | | | |
| iso_a2 | character varying | | | | extended | | | |
| adm0_sr | integer | | | | plain | | | |
| name | character varying | | | | extended | | | |
| name_alt | character varying | | | | extended | | | |
| name_local | character varying | | | | extended | | | |
| type | character varying | | | | extended | | | |
| type_en | character varying | | | | extended | | | |
| code_local | character varying | | | | extended | | | |
| code_hasc | character varying | | | | extended | | | |
| note | character varying | | | | extended | | | |
| hasc_maybe | character varying | | | | extended | | | |
| region | character varying | | | | extended | | | |
| region_cod | character varying | | | | extended | | | |
| provnum_ne | integer | | | | plain | | | |
| gadm_level | integer | | | | plain | | | |
| check_me | integer | | | | plain | | | |
| datarank | integer | | | | plain | | | |
| abbrev | character varying | | | | extended | | | |
| postal | character varying | | | | extended | | | |
| area_sqkm | integer | | | | plain | | | |
| sameascity | integer | | | | plain | | | |
| labelrank | integer | | | | plain | | | |
| name_len | integer | | | | plain | | | |
| mapcolor9 | integer | | | | plain | | | |
| mapcolor13 | integer | | | | plain | | | |
| fips | character varying | | | | extended | | | |
| fips_alt | character varying | | | | extended | | | |
| woe_id | integer | | | | plain | | | |
| woe_label | character varying | | | | extended | | | |
| woe_name | character varying | | | | extended | | | |
| latitude | double precision | | | | plain | | | |
| longitude | double precision | | | | plain | | | |
| sov_a3 | character varying | | | | extended | | | |
| adm0_a3 | character varying | | | | extended | | | |
| adm0_label | integer | | | | plain | | | |
| admin | character varying | | | | extended | | | |
| geonunit | character varying | | | | extended | | | |
| gu_a3 | character varying | | | | extended | | | |
| gn_id | integer | | | | plain | | | |
| gn_name | character varying | | | | extended | | | |
| gns_id | integer | | | | plain | | | |
| gns_name | character varying | | | | extended | | | |
| gn_level | integer | | | | plain | | | |
| gn_region | character varying | | | | extended | | | |
| gn_a1_code | character varying | | | | extended | | | |
| region_sub | character varying | | | | extended | | | |
| sub_code | character varying | | | | extended | | | |
| gns_level | integer | | | | plain | | | |
| gns_lang | character varying | | | | extended | | | |
| gns_adm1 | character varying | | | | extended | | | |
| gns_region | character varying | | | | extended | | | |
| min_label | double precision | | | | plain | | | |
| max_label | double precision | | | | plain | | | |
| min_zoom | double precision | | | | plain | | | |
| wikidataid | character varying | | | | extended | | | |
| name_ar | character varying | | | | extended | | | |
| name_bn | character varying | | | | extended | | | |
| name_de | character varying | | | | extended | | | |
| name_en | character varying | | | | extended | | | |
| name_es | character varying | | | | extended | | | |
| name_fr | character varying | | | | extended | | | |
| name_el | character varying | | | | extended | | | |
| name_hi | character varying | | | | extended | | | |
| name_hu | character varying | | | | extended | | | |
| name_id | character varying | | | | extended | | | |
| name_it | character varying | | | | extended | | | |
| name_ja | character varying | | | | extended | | | |
| name_ko | character varying | | | | extended | | | |
| name_nl | character varying | | | | extended | | | |
| name_pl | character varying | | | | extended | | | |
| name_pt | character varying | | | | extended | | | |
| name_ru | character varying | | | | extended | | | |
| name_sv | character varying | | | | extended | | | |
| name_tr | character varying | | | | extended | | | |
| name_vi | character varying | | | | extended | | | |
| name_zh | character varying | | | | extended | | | |
| ne_id | bigint | | | | plain | | | |
| name_he | character varying | | | | extended | | | |
| name_uk | character varying | | | | extended | | | |
| name_ur | character varying | | | | extended | | | |
| name_fa | character varying | | | | extended | | | |
| name_zht | character varying | | | | extended | | | |
| fclass_iso | character varying | | | | extended | | | |
| fclass_us | character varying | | | | extended | | | |
| fclass_fr | character varying | | | | extended | | | |
| fclass_ru | character varying | | | | extended | | | |
| fclass_es | character varying | | | | extended | | | |
| fclass_cn | character varying | | | | extended | | | |
| fclass_tw | character varying | | | | extended | | | |
| fclass_in | character varying | | | | extended | | | |
| fclass_np | character varying | | | | extended | | | |
| fclass_pk | character varying | | | | extended | | | |
| fclass_de | character varying | | | | extended | | | |
| fclass_gb | character varying | | | | extended | | | |
| fclass_br | character varying | | | | extended | | | |
| fclass_il | character varying | | | | extended | | | |
| fclass_ps | character varying | | | | extended | | | |
| fclass_sa | character varying | | | | extended | | | |
| fclass_eg | character varying | | | | extended | | | |
| fclass_ma | character varying | | | | extended | | | |
| fclass_pt | character varying | | | | extended | | | |
| fclass_ar | character varying | | | | extended | | | |
| fclass_jp | character varying | | | | extended | | | |
| fclass_ko | character varying | | | | extended | | | |
| fclass_vn | character varying | | | | extended | | | |
| fclass_tr | character varying | | | | extended | | | |
| fclass_id | character varying | | | | extended | | | |
| fclass_pl | character varying | | | | extended | | | |
| fclass_gr | character varying | | | | extended | | | |
| fclass_it | character varying | | | | extended | | | |
| fclass_nl | character varying | | | | extended | | | |
| fclass_se | character varying | | | | extended | | | |
| fclass_bd | character varying | | | | extended | | | |
| fclass_ua | character varying | | | | extended | | | |
| geometry | geometry(Geometry,4326) | | | | main | | | |
+------------+-------------------------+-----------+----------+------------------------------------------------------------------------+----------+-------------+--------------+-------------+
Indexes:
"ne_10m_admin_1_states_provinces_lakes_pkey" PRIMARY KEY, btree (ogc_fid)
"ne_10m_admin_1_states_provinces_lakes_geometry_geom_idx" gist (geometry)
Access method: heap |
probably related to a "Shapefiles do not support NULL values. DBase 7 supports NULL values; shapefiles are pre-dBase 7. " https://support.esri.com/en/technical-article/000004294 now the CREATE TABLE "ne_10m_admin_1_states_provinces_lakes" (gid serial,
"featurecla" varchar(20),
"scalerank" int2,
"adm1_code" varchar(9),
"diss_me" int4,
"iso_3166_2" varchar(8),
"wikipedia" varchar(84),
....
"name_he" varchar(63),
"name_uk" varchar(89),
"name_ur" varchar(103),
"name_fa" varchar(92),
"name_zht" varchar(61),
"fclass_iso" varchar(0), <-----------
"fclass_us" varchar(0), <-----------
"fclass_fr" varchar(0), <-----------
"fclass_ru" varchar(12),
"fclass_es" varchar(0), <-----------
"fclass_cn" varchar(18),
"fclass_tw" varchar(12),
"fclass_in" varchar(12),
"fclass_np" varchar(12),
"fclass_pk" varchar(12),
"fclass_de" varchar(0), <-----------
"fclass_gb" varchar(0), <-----------
"fclass_br" varchar(0), <-----------
"fclass_il" varchar(0), <-----------
"fclass_ps" varchar(0), <----------- |
Thank you @ImreSamu, I noticed and was wondering if there is a way the data can be supplied with only fields that contain at least something. This way, we could eliminate having 0 field sizes. In case some new data shows up for a field, you could add that field and update the data version. |
Seems like it could be an empty string not a null. Would that fix your import issues? |
@nvkelso empty strings would not be a good representation of the data in my opinion. I think it would be nice to keep data as original as possible and to a standard. |
🤔
or safer & slower ( with insert )
|
Hi. Since this issue has been referenced from another one in my First of all, for ESRI Shapefiles to be compliant to the standard, they should adhere to dBase III+ specs (yep, even if Wikipedia and other sources report it as dBase IV version, they are wrong. It is actually dBase III+). This means that a zero-sized field is not allowed, since field size must be at least 1. I understand that the purpose here is to have some Since dBase III+ and as a consequence, shapefiles do not allow E.g. A This, of course, is not part of the specs, but it allows the representation of Different software might handle this differently, using another character instead of In this specific scenario, I think the best, most elegant and above all non-breaking solution would be to re-define those zero-sized fields as CHAR(1) or CHAR(n) and pad it with |
This has been resolved in 5.1.1 with an upstream change to mapshaper tool. I'll finish posting the files tonight. |
More specifically, zero length columns are now 1 char long instead (but still null content). |
Fixed in v5.1.1 and released. |
OS: MAC and Linux/Ubuntu
Some of the themes may probably have some errors:
I am not sure what it could be but when trying to dump the data into postgres, the tables below error.
Use shp2pgsql to dump data into Postgres DB
Tables failing
ERROR: length for type varchar must be at least 1
LINE 93: "fclass_iso" varchar(0),
The text was updated successfully, but these errors were encountered: