[gdal-dev] GeoPackage vector driver fails if layer name contains chars not compatible with SQLite

Stefan Keller sfkeller at gmail.com
Mon May 18 08:25:18 PDT 2015


Hi,

GeoPackage vector driver seems to fail if layer name contains chars
not compatible with SQLite (like dashes, '-').

See this:

$ ogr2ogr -f "GPKG" outfile.gpkg infile.geojson -nln layer_a
OK

$ ogrinfo -al -so outfile.gpkg
INFO: Open of `outfile.gpkg'
      using driver `GPKG' successful.
1: layer_a (Polygon)

$ ogr2ogr -f "GPKG" outfile2.gpkg infile.geojson -nln layer-a
ERROR 1: sqlite3_exec(CREATE TABLE layer-a ( fid INTEGER PRIMARY KEY AUTOINCREME
NT, geom POLYGON )) failed: near "-": syntax error
ERROR 1: Terminating translation prematurely after failed
translation of layer OGRGeoJSON (use -skipfailures to skip errors)

$ ogr2ogr -f "SQLite" outfile.sqlite infile.geojson -dsco
SPATIALITE=YES -nln layer-a
OK

$ ogrinfo outfile.sqlite
INFO: Open of `outfile.sqlite'
      using driver `SQLite' successful.
1: layer_a (Polygon)

$ ogr2ogr -f GPKG outfile2.gpkg  WFS:http://maps.zh.ch/wfs/TbaBaustellenZHWFS
ERROR 1: sqlite3_exec(CREATE TABLE baustellen-detailansicht ( fid
INTEGER PRIMARY KEY AUTOINCREMENT, geom POLYGON )) failed: near "-":
syntax error
ERROR 1: Terminating translation prematurely after failed translation
of layer baustellen-detailansicht (use -skipfailures to skip
errors)


Should I add a ticket to https://trac.osgeo.org/gdal/ ?

-S.


More information about the gdal-dev mailing list