duckdb_spatial icon indicating copy to clipboard operation
duckdb_spatial copied to clipboard

SHP driver open_options does not seem to work with ENCODING option

Open ttomasz opened this issue 1 year ago • 2 comments

Example files:

  • small - https://opendata.geoportal.gov.pl/prg/adresy/PunktyAdresowe/02/020101.zip
  • large - https://integracja.gugik.gov.pl/PRG/pobierz.php?adresy_zbiorcze_shp

SQL example:

select *
from st_read('/vsizip/./Downloads/020101.zip/PRG_PunktyAdresowe_020101.shp', open_options=['ENCODING=WINDOWS-1250']) 
limit 5;

Result:

┌─────────┬─────────┬─────────┬─────────────┬─────────┬─────────────────────┬─────────┬───────────────────────────────────────────────┐
│  TERYT  │   PNA   │ SIMC_id │ SIMC_nazwa  │ ULIC_id │     ULIC_nazwa      │  Numer  │                     geom                      │
│ varchar │ varchar │ varchar │   varchar   │ varchar │       varchar       │ varchar │                   geometry                    │
├─────────┼─────────┼─────────┼─────────────┼─────────┼─────────────────────┼─────────┼───────────────────────────────────────────────┤
│ 020101  │ 59-700  │ 0935989 │ ????INVAL…  │ 18648   │ ????INVALID VALUE…  │ 34      │ POINT (260060.88199839657 382544.5259835962)  │
│ 020101  │ 59-700  │ 0935989 │ ????INVAL…  │ 09421   │ ????INVALID VALUE…  │ 82      │ POINT (262141.78239842618 381462.537184705)   │
│ 020101  │ 59-700  │ 0935989 │ ????INVAL…  │ 02058   │ ????INVALID VALUE…  │ 13      │ POINT (258755.64489838033 383519.40798285604) │
│ 020101  │ 59-700  │ 0935989 │ ????INVAL…  │ 07026   │ ????INVALID VALUE…  │ 27C     │ POINT (261791.14839842354 382338.35378450714) │
│ 020101  │ 59-700  │ 0935989 │ ????INVAL…  │ 07026   │ ????INVALID VALUE…  │ 27B     │ POINT (261788.7517984234 382329.84118450433)  │
└─────────┴─────────┴─────────┴─────────────┴─────────┴─────────────────────┴─────────┴───────────────────────────────────────────────┘

Using that encoding in open options works with ogrinfo.

ttomasz avatar Jun 30 '24 11:06 ttomasz

Using that encoding in open options works with ogrinfo.

I suspect the GDAL build of duckdb_spatial isn't built against libiconv

rouault avatar Jul 20 '24 00:07 rouault

Using that encoding in open options works with ogrinfo.

I suspect the GDAL build of duckdb_spatial isn't built against libiconv

Thanks for having a look at this! But yes, it's not built against libiconv. IIRC it was somewhat difficult to build it statically cross platform but we could have another attempt at doing so in the future, ideally after we rework the current build setup, although I don't have a timeline for that.

Maxxen avatar Jul 22 '24 08:07 Maxxen