Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ogr2ogr GML->GPKG conversion via VRT - attribute missing in source data causes error #1699

Open
JohnNewland opened this issue Jul 4, 2019 · 1 comment

Comments

@JohnNewland
Copy link

When using a .vrt template to map GML source data to geopackage, we encounter an error if the source GML file does not contain an optional attribute expected by the .vrt:

ERROR 1: Unable to find source field 'xxx'

This might sound like expected behaviour, but we have multiple GML files and while some files will contain the optional attribute, others do not. This behaviour stops us being able to use .vrt files to process our GML.

Instead of crashing out with an error, it would be ideal to warn and continue processing. This sounds like a logic change with potential other consequences, but I feel the "nullable" attribute of <Field...> should be used to take care of ensuring required attributes exist in the data i.e. we shouldn't be relying on a crash to validate source data.

OS: Windows NT 6.2 (Server 2012)
GDAL version: GDAL 2.4.0, released 2018/12/14

Example data:
example.zip
Example error:
ERROR 1: Unable to find source field 'optionalAttribute'.

Example command line:
ogr2ogr -dsco VERSION=1.2 -f GPKG example.gpkg example.vrt -a_srs EPSG:27700 -lco SPATIAL_INDEX=NO

Thank you.

@rouault
Copy link
Member

rouault commented Jul 4, 2019

The current behaviour is expected. Probably the best option if we wanted to change that would be to add a acceptMissingInSource="true" attribute

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

No branches or pull requests

2 participants