Skip to content

Add support for field domains - #3638

Merged
rouault merged 17 commits into
OSGeo:masterfrom
rouault:fielddomain
Apr 3, 2021
Merged

rouault merged 17 commits into
OSGeo:masterfrom
rouault:fielddomain

Conversation

@rouault

@rouault rouault commented Apr 2, 2021

Copy link
Copy Markdown
Member

Field domains are a concept found in FileGeodatabase, and also in GeoPackage (as data column constraints)

  • Add C/C++/SWIG API to deal with field domains, and implement in Memory driver
  • FileGDB driver: add reporting of field domains
  • OpenFileGDB driver: add reporting of field domains
  • GPKG: add read/write support for field domains
  • ogrinfo: report field domain type and add '-fielddomain name' switch
  • ogr2ogr: add propagation of field domains
  • ogr2ogr: add a -resolveDomains switch

@rouault rouault added this to the 3.3.0 milestone Apr 2, 2021

@nyalldawson nyalldawson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks perfect to me -- nothing else to comment!

@rouault
rouault merged commit c74e3f0 into OSGeo:master Apr 3, 2021
@sgillies

sgillies commented Apr 3, 2021 •

Copy link
Copy Markdown
Contributor

@rouault field domains seem to touch everything and yet I've never heard of them. Are they part of the OGR data model now? Will the fiona project have to be aware of them? How does this impact users? Can you explain more or link to a reference?

@rouault

rouault commented Apr 3, 2021

Copy link
Copy Markdown
Member Author

Some documentation:
https://trac.osgeo.org/gdal/ticket/5741
http://www.geopackage.org/spec/#extension_schema
https://desktop.arcgis.com/en/arcmap/latest/manage-data/geodatabases/an-overview-of-attribute-domains.htm
https://gdal.org/doxygen/classOGRFieldDomain.html#details
https://gdal.org/doxygen/classOGRCodedFieldDomain.html#details
https://gdal.org/doxygen/classOGRRangeFieldDomain.html#details
https://gdal.org/programs/ogrinfo.html#cmdoption-ogrinfo-fielddomain
https://gdal.org/programs/ogr2ogr.html#cmdoption-ogr2ogr-resolveDomains

Are they part of the OGR data model now?

yes, as additional information

Will the fiona project have to be aware of them?

Potentially. This new capability doesn't modify the default output, that is codes in fields that have a code->description mapping are still output. If you want the description of a code, then you can use the enumeration of the field domain to do the substitution.

@rouault

rouault commented Apr 3, 2021

Copy link
Copy Markdown
Member Author
$ ogrinfo ../autotest/ogr/data/gpkg/domains.gpkg  -al -so
[...]
FID Column = fid
Geometry Column = geom
with_range_domain_int: Integer (0.0), domain name=range_domain_int
with_range_domain_int64: Integer64 (0.0), domain name=range_domain_int64
with_range_domain_real: Real (0.0), domain name=range_domain_real
with_glob_domain: String (0.0), domain name=glob_domain
with_enum_domain: Integer (0.0), domain name=enum_domain
$ ogrinfo ../autotest/ogr/data/gpkg/domains.gpkg -fielddomain enum_domain
[...]

Domain enum_domain:
  Type: coded
  Field type: Integer
  Split policy: default value
  Merge policy: default value
  Coded values:
    1: one
    2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants