1

We are using ogr2ogr to convert GML to Geopackage v1.2, using a .vrt to enforce a "schema" (reason: the greater control it offers over using a .gfs mapping file (e.g. enforcing nullable fields, mapping the gml ids to something other than gml_id)).

Per GML feature, fields only exist IF they have data. For instance, feature X may have a name and an alternateName but feature Y only has a name (no alternateName). Note: it isn't empty/null, it's just missing altogether.

This trips up ogr2ogr when that field is not provided for a particular feature (e.g. feature Y): ERROR 1: Unable to find source field alternateName

Using a .gfs does not give us this issue, but has the disadvantages mentioned previously.

Ideally, we would be able to let ogr2ogr know that we don't care if the field is found in the source data, just map it anyway (as null or empty), but I can't find any appropriate configuration option.

EDIT - i raised the following issue on the GDAL github https://github.com/OSGeo/gdal/issues/1699

closed as off-topic by nmtoken, Vince, Kadir Şahbaz, Jochen Schwarze, Fran Raga Jul 23 at 6:16

  • This question does not appear to be about geographic information systems (GIS) within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Could you provide some test data? An alternative could be to use the GMLAS driver gdal.org/drv_gmlas.html. – user30184 Mar 27 at 16:06
  • 4
    I'm voting to close this question as off-topic because, as stated as a response to the issue raised on GitHub,The current behaviour is expected. – nmtoken Jul 22 at 21:40

Browse other questions tagged or ask your own question.