[gdal-dev] Reading gml with schema

Even Rouault even.rouault at mines-paris.org
Wed May 29 07:56:14 PDT 2013


Le mercredi 29 mai 2013 16:33:49, Ari Jolma a écrit :
> On 05/29/2013 05:00 PM, Even Rouault wrote:
> >> 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(?).
> > 
> > I made a quick serach but I couldn't find a definitive answer on whether
> > XSLT processors can operate with a SAX parser, and not only on a DOM.
> 
> I meant also how would it work with GDAL. How to organize the piping?
> For example with ogrinfo:
> 
> mkfifo x
> cat maastotieto.gml | xslt > x
> ogrinfo x
> 
> Would this work?

Well, the situation is a bit complicated and needs some explanation. The GML 
driver needs to know the schema of the data, in a broad sense. The schema can 
be of course the .xsd, provided that the OGR GML XSD parser can understand it 
(see previous emails). If there's no .xsd or if it cannot be understood, the 
GML driver will make a full analysis of the file to deduce automatically a 
schema that will be written in a .gfs file. When the .xsd or .gfs file are 
generated, the driver is able to parse the GML in a streaming mode.

So, the above would (likely, I have not tested) work if a x.gfs file already 
exists. As all files conforming to the Maastotiedot.xsd have the same 
structure, you could likely use a .gfs generated for one of them for the other 
ones (caution: this file must have all the possible classes so they are 
recorded in the .gfs)

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list