[gdal-dev] ogrinfo only sees 1 polygon in GML file

Even Rouault even.rouault at mines-paris.org
Wed Jan 29 06:23:32 PST 2014


Le mercredi 29 janvier 2014 12:51:25, peifer a écrit :
> Hi,
> 
> I have a GML file [1], which according to my understanding has 7 polygon
> features [2]. ogrinfo only sees 1 feature [3], which is the last one in
> document order (gml:id="ZON_NO0005_Polygon").
> 
> Can someone please tell me if the observed ogrinfo behaviour is a known
> limitation of the GML driver, a bug -- or if I am perhaps doing something
> terribly wrong? I am using GDAL from trunk, by the way.

Hermann,

It is (was) a limitation of the GML driver. The issue is that from its point 
of view there's only one feature AQD_ReportingHeader, but you are interested 
into its sub-elements AQD_Zone, and the GML parser isn't smart enough to guess 
your intention.

Two solutions :
- one that implies a text editor to rename a few elements in the GML itself. 
Rename "featureMember" into "foobaroranythingyouwant" and "content>" into 
"contentMember>" (needs to end with Member). The OGR GML parser will then find 
the sub features (remove the .gfs file before)

- upgrade to latest trunk and use the attached AQD_Zones.gfs file. It is a 
modification of the base AQD_Zones.gfs file produced when reading the first time 
the GML file with the following changes : the ElementPath for the feature has 
been modified to include full path from top level XML element, and the 
ElementPath of attributes have been modified to remove content|AQD_Zone| from 
their path.

Best regards,

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html
-------------- next part --------------
<GMLFeatureClassList>
  <GMLFeatureClass>
    <Name>AQD_Zone</Name>
    <ElementPath>featureMember|AQD_ReportingHeader|content|AQD_Zone</ElementPath>
    <GeometryType>3</GeometryType>
    <SRSName>GEOGCS["ETRS89",DATUM["European_Terrestrial_Reference_System_1989",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6258"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4258"]]</SRSName>
    <PropertyDefn>
      <Name>localId</Name>
      <ElementPath>inspireId|Identifier|localId</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>namespace</Name>
      <ElementPath>inspireId|Identifier|namespace</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>versionId</Name>
      <ElementPath>inspireId|Identifier|versionId</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>language</Name>
      <ElementPath>name|GeographicalName|language</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>text</Name>
      <ElementPath>name|GeographicalName|spelling|SpellingOfName|text</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>beginPosition</Name>
      <ElementPath>designationPeriod|TimePeriod|beginPosition</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>CharacterString</Name>
      <ElementPath>competentAuthority|RelatedParty|individualName|CharacterString</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>competentAuthority|RelatedParty|organisationName|CharacterString</Name>
      <ElementPath>competentAuthority|RelatedParty|organisationName|CharacterString</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>competentAuthority|RelatedParty|contact|Contact|address|AddressRepresentation|adminUnit|GeographicalName|language</Name>
      <ElementPath>competentAuthority|RelatedParty|contact|Contact|address|AddressRepresentation|adminUnit|GeographicalName|language</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>competentAuthority|RelatedParty|contact|Contact|address|AddressRepresentation|adminUnit|GeographicalName|spelling|SpellingOfName|text</Name>
      <ElementPath>competentAuthority|RelatedParty|contact|Contact|address|AddressRepresentation|adminUnit|GeographicalName|spelling|SpellingOfName|text</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>locatorDesignator</Name>
      <ElementPath>competentAuthority|RelatedParty|contact|Contact|address|AddressRepresentation|locatorDesignator</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>postCode</Name>
      <ElementPath>competentAuthority|RelatedParty|contact|Contact|address|AddressRepresentation|postCode</ElementPath>
      <Type>IntegerList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>electronicMailAddress</Name>
      <ElementPath>competentAuthority|RelatedParty|contact|Contact|electronicMailAddress</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>telephoneVoice</Name>
      <ElementPath>competentAuthority|RelatedParty|contact|Contact|telephoneVoice</ElementPath>
      <Type>RealList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>website</Name>
      <ElementPath>competentAuthority|RelatedParty|contact|Contact|website</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>beginLifespanVersion</Name>
      <ElementPath>beginLifespanVersion</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>name</Name>
      <ElementPath>legalBasis|LegislationCitation|name</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>shortName</Name>
      <ElementPath>legalBasis|LegislationCitation|shortName</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>Date</Name>
      <ElementPath>legalBasis|LegislationCitation|date|CI_Date|date|Date</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>link</Name>
      <ElementPath>legalBasis|LegislationCitation|link</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>identificationNumber</Name>
      <ElementPath>legalBasis|LegislationCitation|identificationNumber</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>officialDocumentNumber</Name>
      <ElementPath>legalBasis|LegislationCitation|officialDocumentNumber</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>dateEnteredIntoForce</Name>
      <ElementPath>legalBasis|LegislationCitation|dateEnteredIntoForce</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>zoneCode</Name>
      <ElementPath>zoneCode</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>residentPopulation</Name>
      <ElementPath>residentPopulation</ElementPath>
      <Type>IntegerList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>timePosition</Name>
      <ElementPath>residentPopulationYear|TimeInstant|timePosition</ElementPath>
      <Type>IntegerList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>area</Name>
      <ElementPath>area</ElementPath>
      <Type>IntegerList</Type>
    </PropertyDefn>
    <PropertyDefn>
      <Name>area_uom</Name>
      <ElementPath>area_uom</ElementPath>
      <Type>StringList</Type>
    </PropertyDefn>
  </GMLFeatureClass>
</GMLFeatureClassList>


More information about the gdal-dev mailing list