[gdal-dev] GFS with condition on the second last element

Raymond Nijssen r.nijssen at terglobo.nl
Wed Jun 24 20:29:45 PDT 2020


Thanks Even,

Then at least I can stop searching.

For now I will move to iterparse in python, which is slow but very flexible.

Raymond


On 24-06-2020 18:11, Even Rouault wrote:
> On mercredi 24 juin 2020 17:14:50 CEST Raymond Nijssen wrote:
> 
>  > Hi list,
> 
>  >
> 
>  > I'm trying to read a complex gml file that includes values that need to
> 
>  > be selected on an xml attribute. This is possible to do with a condition
> 
>  > in the gfs file, but the example only covers having the attribute on the
> 
>  > last element in the elementPath:
> 
>  >
> 
>  > 
> https://gdal.org/drivers/vector/gml.html#using-conditions-on-xml-attributes
> 
>  >
> 
>  >
> 
>  > But mine is on the 2nd last element, like this:
> 
>  >
> 
>  > ```
> 
>  > <imaer:result>
> 
>  > <imaer:Result resultType="DEPOSITION" substance="NH3">
> 
>  > <imaer:value>0.01909</imaer:value>
> 
>  > </imaer:Result>
> 
>  > </imaer:result>
> 
>  > <imaer:result>
> 
>  > <imaer:Result resultType="DEPOSITION" substance="NOX">
> 
>  > <imaer:value>0.001341</imaer:value>
> 
>  > </imaer:Result>
> 
>  > </imaer:result>
> 
>  > ```
> 
>  >
> 
>  > So I'd like to do something like this in my gfs:
> 
>  >
> 
>  > ```
> 
>  > <PropertyDefn>
> 
>  > <Name>nh3</Name>
> 
>  > <ElementPath>result|Result|value</ElementPath>
> 
>  > <Condition>result|Result at substance='NH3'</Condition>
> 
>  > <Type>Real</Type>
> 
>  > </PropertyDefn>
> 
>  > ```
> 
>  >
> 
>  > to only catch the value where substance = NH3. I've been trying many
> 
>  > options but no success yet.
> 
>  >
> 
>  >
> 
>  > Is this even possible?
> 
> No, this isn't possible. As documented, Condition capabilities are 
> limited to filtering on an attribute of the same element whose value you 
> want to retrieve.
> 
> You would probably have more capabilities by using the GMLAS driver, and 
> filtering on its output.
> 
> Even
> 
> -- 
> 
> Spatialys - Geospatial professional services
> 
> http://www.spatialys.com
> 


More information about the gdal-dev mailing list