Ticket #1166 (closed bug: wontfix)

Opened 6 years ago

Last modified 5 years ago

OpenLayers.Format.GML does not correctly extract GML3 Feature ID

Reported by: openlayers Owned by: tschaub
Priority: blocker Milestone:
Component: Format.GML Version: 2.5
Keywords: WFS 1.1.0 GML GML3 Cc:
State:

Description

I've been working with WFS 1.1.0 lately and noticed that the Feature ID is not being extracted correctly for GML3 data by OpenLayers.Format.GML.

The current code is

fid = childNode.getAttribute("fid")

childNode.getAttribute("id");

I assume that the latter call is for GML3. In GML3, however, the id attribute must be namespace qualified. I suppose it may work if  http://www.opengis.net/gml is the default namespace. Since IE doesn't support getAttributeNS, I fixed my local copy like this:

fid = childNode.getAttribute("fid")

childNode.getAttribute("id");

if (!fid) {

for (var index = 0; index < childNode.attributes.length; index++) {

var length = childNode.attributes[index].nodeName.length;

if ((length > 3) && (childNode.attributes[index].nodeName.substring(length-3) == ":id")) {

fid = childNode.attributes[index].nodeValue;

break;

}

}

}

It works in FF2/IE7 for WFS 1.0.0/1.1.0.

Attachments

GML3CodeChanges.txt Download (0.7 KB) - added by openlayers 5 years ago.
Recommended code changes.

Change History

Changed 5 years ago by openlayers

Recommended code changes.

Changed 5 years ago by crschmidt

  • state set to Needs More Work

This isn't a patch, and this seems like something that we should really add tests for if we're going to add it.

Changed 5 years ago by tschaub

  • status changed from new to closed
  • state Needs More Work deleted
  • resolution set to wontfix

Our GML format is really a GML2 format. We don't correctly deal with many things in GML3. I'm inclined to close this ticket and wait until we have a patch for GML3 (or at least more of it than just an id). I don't necessarily like the idea of continuing to glob together versions in a single class.

Note: See TracTickets for help on using tickets.