[gdal-dev] ogr2ogr 1.9 gml3.2 output and multisurface
even.rouault at mines-paris.org
Fri Dec 9 14:00:04 EST 2011
> I have a question regarding GML3.2 output from ogr2ogr in GDAL 1.9 (from
> a daily build from a few days ago). I have a sample shapefile (found at
> http://www.vdstech.com/mapdata/canada.zip) that I've tried to convert to
> GML 3.2 using the command "ogr2ogr -f GML canada.xml canada.shp -dsco
Thanks for your testing and reporting.
> When I try to validate the resulting file (using xerces via the oXygen
> editor, as well as the .NET xml schema libraries) there are a couple of
> - The XML file sometimes includes the element gml:MultiSurface in the
> element ogr:geometryProperty, which the XML 3.2.1 schema does not allow,
> as ogr:geometryProperty is defined in the generated XSD file to be of
> type gml:SurfacePropertyType, which only allows elements in the
> substitution group gml:AbstractSurface. gml:MultiSurface is not in that
Ok, that's in fact a problem with the behaviour of the shapefile driver that is
used as a source. In shapefiles, there's no way to know in advance (without
iterating over all the geometries!) if the geometries are POLYGON or
MULTIPOLYGON. Currently (and this has been the case over the last 10 years
;-)), the shapefile driver advertizes the layer to be of type POLYGON, but
features with MULTIPOLYGON geometries can be reported... (That's an issue for
conversion to other drivers, like Postgis too. Perhaps we should just force
translation of geometries of shapefile polygon layers as MULTIPOLYGON and then
advertize the layer as being MULTIPOLYGON.)
The XSD declaration is based on the declared layer type, hence
This can be solved by 2 similar solutions. Add -nlt MULTIPOLYGON to your
ogr2ogr command line to force conversion of simple polygons to multipolygons.
Or add -nlt GEOMETRY so that the target layer is just advertized as being of
type wkbUnknown, which will be translated as a gml:GeometryPropertyType in the
> - Inside the gml:MultiSurface elements, the individual gml:Polygon
> elements do not have id attributes, which xerces complains about.
That was a real bug. Just fixed by r23502.
More information about the gdal-dev