From 7f7f946c2947d1e681d5b832fcea78be7f56d508 Mon Sep 17 00:00:00 2001 From: fredj Date: Fri, 18 Nov 2011 11:24:33 +0100 Subject: [PATCH] Stop using deprecated Layer.GML in examples --- examples/georss-flickr.html | 29 ++++++++++++++--------------- examples/gml-layer.html | 8 +++++++- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/examples/georss-flickr.html b/examples/georss-flickr.html index 94da9949f8..5591b0ccb0 100644 --- a/examples/georss-flickr.html +++ b/examples/georss-flickr.html @@ -50,21 +50,20 @@ style.addRules([rule, elseRule]); - // Create a GML layer with GeoRSS format and a style map. - markerLayer = new OpenLayers.Layer.GML("Some images from Flickr", - "xml/georss-flickr.xml", { - format: OpenLayers.Format.GeoRSS, - formatOptions: { - // adds the thumbnail attribute to the feature - createFeatureFromItem: function(item) { - var feature = OpenLayers.Format.GeoRSS.prototype - .createFeatureFromItem.apply(this, arguments); - feature.attributes.thumbnail = - this.getElementsByTagNameNS( - item, "*", "thumbnail")[0].getAttribute("url"); - return feature; - } - }, + // Create a Vector layer with GeoRSS format and a style map. + markerLayer = new OpenLayers.Layer.Vector("Some images from Flickr", { + protocol: new OpenLayers.Protocol.HTTP({ + url: "xml/georss-flickr.xml", + format: new OpenLayers.Format.GeoRSS({ + // adds the thumbnail attribute to the feature + createFeatureFromItem: function(item) { + var feature = OpenLayers.Format.GeoRSS.prototype.createFeatureFromItem.apply(this, arguments); + feature.attributes.thumbnail = this.getElementsByTagNameNS(item, "*", "thumbnail")[0].getAttribute("url"); + return feature; + } + }) + }), + strategies: [new OpenLayers.Strategy.Fixed()], // Giving the style map keys for "default" and "select" // rendering intent, to make the image larger when selected styleMap: new OpenLayers.StyleMap({ diff --git a/examples/gml-layer.html b/examples/gml-layer.html index eea465dcec..a87a5f333e 100644 --- a/examples/gml-layer.html +++ b/examples/gml-layer.html @@ -20,7 +20,13 @@ "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} ); map.addLayer(layer); map.zoomToExtent(new OpenLayers.Bounds(-3.922119,44.335327,4.866943,49.553833)); - map.addLayer(new OpenLayers.Layer.GML("GML", "gml/polygon.xml")); + map.addLayer(new OpenLayers.Layer.Vector("GML", { + protocol: new OpenLayers.Protocol.HTTP({ + url: "gml/polygon.xml", + format: new OpenLayers.Format.GML() + }), + strategies: [new OpenLayers.Strategy.Fixed()] + })); }