[gdal-dev] Reading gml with schema

Even Rouault even.rouault at mines-paris.org
Tue May 28 13:40:20 PDT 2013


Le mardi 28 mai 2013 19:47:38, Ari Jolma a écrit :
> On 05/28/2013 05:34 PM, Lauri Kajan wrote:
> > Hi Ari,
> > 
> > I think that shouldn't be neccessary.
> > The gml file points to the xsd schema file
> > (http://xml.nls.fi/XML/Schema/Maastotietojarjestelma/MTK/201202/Maastotie
> > dot.xsd). In this schema those tags are defined to be "aliases" for these
> > known gml tags by using the substitutionGroup. So actually that
> > <Maastotiedot> is a <gml:FeatureCollection>. Is this supported by OGR?
> 
> I think GDAL wants the xsd to be local file for GML files. However, I
> tried this and I can see GDAL finding the xsd, but failing the overall
> process. Further, it seems that GDAL does not recognize the XML include
> tag.
> 
> Anyway, I assume it is not a simple substitution as all features should
> be wrapped into gml:featureMember elements.

Lauri,

Generic GML reading is a very complicated task, since it can model very 
complex data organizations that cannot be represented trivially in the OGR 
data model. Basically the GML reader in OGR is limited to GML documents 
respecting Simple Feature profiles ( GML 3.1.1 simple features profile - OGC(R) 
06-049r1 ). The XSD parser in the GML reader has similar limitations.

The GML reader only tries to analyze the .xsd if it has the same basename as 
the .gml document. Starting with OGR 1.10, you can specify as datasource name 
something like "foo.gml,xsd=bar.xsd". In that instance, Maastotiedot.xsd is 
too complex for the XSD parser to be analyzed. And as the naming of elements 
in the GML doesn't match the hard coded convention of the OGR GML driver 
("somethingMember" elements, usual names for GML geometry elements), the 
autodiscovery of the schema fails also.

However when looking at the GML itself, it should be possible with moderate 
tweaking to make the GML driver aware of the structure of that particular 
schema (provided that it is worth the effort, i.e. there are a significant 
number of GML files following that schema, which must likely be the case if it 
is a sample of the National Land Suvey of Finnish), since it is close from 
what it can understand currently. It has already been done in similar 
situations.

Best regards,

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130528/a73197d5/attachment.html>


More information about the gdal-dev mailing list