Opened 13 years ago

Closed 5 years ago

#2856 closed enhancement (fixed)

Relaxing parsing of GML files in OGR

Reported by: aps03pwb Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: svn-trunk
Severity: normal Keywords: gml xml parse
Cc:

Description

OGR currently only recognises GML files when it locates <featureMember> tags with gml tags inside. If no featureMember tags are located it returns an error. The featureMember element is absent from many application schemas (including quite popular ones like GeoRSS) and is also asent from the SF-GML specification.

I would like OGR to complete a second (more relaxed) parse if the initial parse fails whereby it locates gml geometry tags and assumes that the tag two levels up is equivalent to the featureMember element. This should enable GDAL to read XML files that use GML only for a minor subset of their schema.

By peforming the strict parse first and only performing the relaxed parse if the strict parse fails, this enhancement should not negatively impact currently compatible GML files.

Attachments (3)

works.gml (1.2 KB ) - added by aps03pwb 13 years ago.
Example of a simple XML file containing GML as a minor component. The current implementation of OGR accepts this file
fails.gml (1.2 KB ) - added by aps03pwb 13 years ago.
Example of a simple XML file containing GML as a minor component that is rejected by OGR
rss.xml (154.8 KB ) - added by aps03pwb 13 years ago.
Example GeoRSS file that is rejected by OGR

Download all attachments as: .zip

Change History (6)

by aps03pwb, 13 years ago

Attachment: works.gml added

Example of a simple XML file containing GML as a minor component. The current implementation of OGR accepts this file

by aps03pwb, 13 years ago

Attachment: fails.gml added

Example of a simple XML file containing GML as a minor component that is rejected by OGR

by aps03pwb, 13 years ago

Attachment: rss.xml added

Example GeoRSS file that is rejected by OGR

comment:1 by Even Rouault, 13 years ago

As far as GeoRSS is concerned, there's a new OGR driver that specifically read and write that format. It will be in GDAL 1.7.0. See http://gdal.org/ogr/drv_georss.html. It can read your example rss.xml.

comment:2 by Jukka Rahkonen, 7 years ago

GDAL 2.1-dev can read rss.xml. It does not find anything from "fails.gml" but I can't judge if it should.

comment:3 by Jukka Rahkonen, 5 years ago

Resolution: fixed
Status: newclosed

The new GMLAS driver gives an error about fails.gml: "No schema locations found when analyzing data file: XSD open option must be provided"

The test file does not seem to be valid. Otherwise I believe that GMLAS couuld resolve the schema and find the geometry. Closing because impossible to test any better now, and due to many years inactivity.

Note: See TracTickets for help on using tickets.