[gdal-dev] Reading gml with schema

Ari Jolma ari.jolma at gmail.com
Wed May 29 06:37:38 PDT 2013


On 05/28/2013 11:40 PM, Even Rouault wrote:
>
> 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 
> <http://portal.opengeospatial.org/files/?artifact_id=15201> ). 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.
>


I'm cc'ing Pekka Sarkola, as I remember him asking about this a while back.

Even, by tweaking I hope you mean tweaking the GML itself? As I believe 
(being quite ignorant of / unexperienced with XSLT) that with a simple 
XSLT the XML could be made readable by GDAL. Again, being unexperienced 
with XSLT, I'm not sure but hope that XSLT processors run in sequential 
mode, thus the reading could be conveniently handled with a pipe. Hmm, 
how would that actually work, I'm not sure(?).

Anyway, if and when this is *the* GML format NLS Finland uses to serve 
its data, it would be worthwhile to develop a publishable solution.

Cheers,

Ari


> 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/20130529/f6a1cbfc/attachment-0001.html>


More information about the gdal-dev mailing list