Stop using deprecated Layer.GML in examples
This commit is contained in:
+14
-15
@@ -50,21 +50,20 @@
|
|||||||
|
|
||||||
style.addRules([rule, elseRule]);
|
style.addRules([rule, elseRule]);
|
||||||
|
|
||||||
// Create a GML layer with GeoRSS format and a style map.
|
// Create a Vector layer with GeoRSS format and a style map.
|
||||||
markerLayer = new OpenLayers.Layer.GML("Some images from Flickr",
|
markerLayer = new OpenLayers.Layer.Vector("Some images from Flickr", {
|
||||||
"xml/georss-flickr.xml", {
|
protocol: new OpenLayers.Protocol.HTTP({
|
||||||
format: OpenLayers.Format.GeoRSS,
|
url: "xml/georss-flickr.xml",
|
||||||
formatOptions: {
|
format: new OpenLayers.Format.GeoRSS({
|
||||||
// adds the thumbnail attribute to the feature
|
// adds the thumbnail attribute to the feature
|
||||||
createFeatureFromItem: function(item) {
|
createFeatureFromItem: function(item) {
|
||||||
var feature = OpenLayers.Format.GeoRSS.prototype
|
var feature = OpenLayers.Format.GeoRSS.prototype.createFeatureFromItem.apply(this, arguments);
|
||||||
.createFeatureFromItem.apply(this, arguments);
|
feature.attributes.thumbnail = this.getElementsByTagNameNS(item, "*", "thumbnail")[0].getAttribute("url");
|
||||||
feature.attributes.thumbnail =
|
return feature;
|
||||||
this.getElementsByTagNameNS(
|
}
|
||||||
item, "*", "thumbnail")[0].getAttribute("url");
|
})
|
||||||
return feature;
|
}),
|
||||||
}
|
strategies: [new OpenLayers.Strategy.Fixed()],
|
||||||
},
|
|
||||||
// Giving the style map keys for "default" and "select"
|
// Giving the style map keys for "default" and "select"
|
||||||
// rendering intent, to make the image larger when selected
|
// rendering intent, to make the image larger when selected
|
||||||
styleMap: new OpenLayers.StyleMap({
|
styleMap: new OpenLayers.StyleMap({
|
||||||
|
|||||||
@@ -20,7 +20,13 @@
|
|||||||
"http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
|
"http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
map.zoomToExtent(new OpenLayers.Bounds(-3.922119,44.335327,4.866943,49.553833));
|
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()]
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Reference in New Issue
Block a user