Recent versions of OGR make a difference between : - a missing XML element, that will be represented in OGR as a "unset field") (allowed if the schema has minOccurs="0") - and a XML element set to <foo xsi:nil="true"/>, that will be represented in OGR as a NULL field value (allowed if the schema has nillable="true")
( see https://trac.osgeo.org/gdal/wiki/rfc67_nullfieldvalues ) The same for JSon actually, between a property that doesn't appear at all, or which is set to null. Example, given foo.json with { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "a": 1, "null_prop": null }, "geometry": null }, { "type": "Feature", "properties": { "b": 2 }, "geometry": null } ] } $ ogr2ogr foo.gml foo.json -f gml $ cat foo.gml <?xml version="1.0" encoding="utf-8" ?> <ogr:FeatureCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ogr.maptools.org/ foo.xsd" xmlns:ogr="http://ogr.maptools.org/" xmlns:gml="http://www.opengis.net/gml"> <gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy> <gml:featureMember> <ogr:foo fid="foo.0"> <ogr:a>1</ogr:a> <ogr:null_prop xsi:nil="true"/> </ogr:foo> </gml:featureMember> <gml:featureMember> <ogr:foo fid="foo.1"> <ogr:b>2</ogr:b> </ogr:foo> </gml:featureMember> </ogr:FeatureCollection> $ ogr2ogr out.json foo.gml $ ogrinfo foo.gml -al INFO: Open of `foo.gml' using driver `GML' successful. Layer name: foo Geometry: Unknown (any) Feature Count: 2 Layer SRS WKT: (unknown) Geometry Column = geometryProperty fid: String (0.0) NOT NULL a: Integer (16.0) null_prop: String (0.0) b: Integer (16.0) OGRFeature(foo):0 fid (String) = foo.0 a (Integer) = 1 null_prop (String) = (null) OGRFeature(foo):1 fid (String) = foo.1 b (Integer) = 2 And yes this is not WFS or GML specific, but XML + XML-Schema generic. -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
