[gdal-dev] Does OGR support GeoPackage enums in write mode (or at all?)

Even Rouault even.rouault at spatialys.com
Wed Apr 15 02:36:17 PDT 2020


Hi Andrea,

> but could be more efficiently represented as enums, as they
>have a small set of values.

> GeoPackage has a native notion of enums, check the spec and search for
> "table 27" for an example:
> http://www.geopackage.org/spec/

My understanding of table 27 is that it is just to define constraints on the values of a column, 
but not a way to establish a integer<-->string mapping as you'd like. Unless I'm missing 
something. Of course you could create an auxiliary table with the mapping, but I'm not aware 
of a standardized way of registering it.

> So I'm wondering, is there direct support for enum fields? 

No, there's no such concept of enum fields in the OGR data model itself

The schema extension ( http://www.geopackage.org/spec/#extension_schema ) is 
minimilastically implement in the OGR GPKG driver. It just supports setting the mime_type of 
a column to "application/json" to map from/to the OGR type=string, subtype=json for 
columns.

> Any way to map a string column to enum during a ogr2ogr call?

If there was really a way to encode what you want to do in the specification, I'imagine that 
could potentially be a new driver specific option where you would provide the mapping.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200415/5fc56c14/attachment.html>


More information about the gdal-dev mailing list