OpenLayers OpenLayers

Ticket #1547 (new feature)

Opened 3 months ago

Last modified 2 months ago

Format.GML: introduce option to postpone parsing of the geometries

Reported by: bartvde Assigned to: tschaub
Priority: minor Milestone: 2.7 Release
Component: Format.GML Version: 2.6
Keywords: Cc:
State: Needs Discussion

Description

This is not the most common use-case, but it is one IMHO. Imagine you want to use Format.GML to fill an attribute table. Now the parsing of geometries can be quite consuming, and you might want to postpone the parsing until it is really necessary, e.g. when the user presses the highlight feature button in the toolbar above the grid. Currently there is no way to do this.

My proposal would be to introduce a property for this, and to cache the DOMElement on the feature so it can be easily parsed later on when necessary.

Attachments

ticket1547.patch (3.3 kB) - added by bartvde on 05/14/08 07:40:53.
Patch implementing extractGeometry APIProperty on Format.GML

Change History

05/14/08 07:40:53 changed by bartvde

  • attachment ticket1547.patch added.

Patch implementing extractGeometry APIProperty on Format.GML

05/14/08 07:45:28 changed by bartvde

  • keywords set to needs discussion.

I've attached a proposed patch. Things which need discussion:

1) is it okay to add properties to OpenLayers.Feature.Vector which are not advertized in that class? I want to cache the geometryNode, and I named the property feature.geometryNode. But I don't know if this is allowed without specifying it in Vector.js.

2) maybe it's necessary to create another APIProperty called cacheGeometryNode? Now by default I cache the node when parseGeometry is false, but maybe this is not flexible enough and we need an extra property to control the caching?

An example usage is:

            var gmlParser = new OpenLayers.Format.GML();
            var feature = row.get('feature');
            if (!feature.geometry) {
                var type = feature.geometryNode.type;
                var parser = gmlParser.parseGeometry[type.toLowerCase()];
                if(parser) {
                    var geometry = parser.apply(gmlParser,
                        [feature.geometryNode.node]);
                    feature.geometry = geometry;
                    this.layer.addFeatures(feature);
                }
            } else {
                this.layer.addFeatures(feature);
            }

05/14/08 07:45:57 changed by bartvde

  • keywords deleted.
  • state set to Needs Discussion.

05/14/08 09:09:16 changed by bartvde

  • milestone set to 2.7 Release.

06/21/08 10:40:00 changed by crschmidt

The answer to the former is 'Yes, that's fine', the answer to the latter is, in my mind, 'no, we don't need that.'