Hello,

I'm having trouble parsing some GML via Python/ogr and would like some advice.

The GML has as the top level a FeatureCollection which has 3 featureMembers. However, each of those featureMembers contains a FeatureCollection within it containing any number of featureMembers.

While parsing, each of the featureMembers has a dict of elements, and the values of that featureMembers' keys is a list of the values of each of the "sub-featureMember"s attributes. That's good so far, but I'm not able to retrieve the geometry for the sub-featureMembers.

How do I use Python ogr to parse a FeatureCollection within a FeatureCollection? Does a ResetReading() somehow reset something so that the inner members get processed correctly?

Thank you,
Wendell

A sample of the nested xml components:

<?xml version="1.0" encoding="utf-8"?>
<wx:FeatureCollection gml:id="id0" ...>

 <wx:featureMember>
  <wx:Forecast gml:id="id1">

   <om:result>
    <wx:FeatureCollection gml:id="id5">

     <wx:featureMember>
      <wx:Contour gml:id="id6">
       <wx:geometry>
           ...
       </wx:geometry>
      </wx:Contour>
     </wx:featureMember>

     <wx:featureMember>
      <wx:Contour gml:id="id10">
       <wx:geometry>
           ...
       </wx:geometry>
      </wx:Contour>
     </wx:featureMember>

    </wx:FeatureCollection>
   </om:result>
  </wx:Forecast>
 </wx:featureMember>

 <wx:featureMember>
  <wx:Forecast gml:id="id1438">
   <om:result>
    <wx:FeatureCollection gml:id="id1442">
     <wx:featureMember>
         ...
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to