Hi all,
I add a vector layer with GPX file to my map. Now I will change the url of GPX
file in vector layer. There is no special function for this. For GML layer it
is possible to call setUrl(). This isn’t possible for vector layers, so I do
this:
function setNewUrl(){
myVectorLayer.setVisibility(false);
myVectorLayer.destroyFeatures();
myVectorLayer.protocol.url = newUrl;
myVectorLayer.protocol.options.url = newUrl;
myVectorLayer.drawn = false;
myVectorLayer.setVisibility(true);
}
My vector layer:
var myVectorLayer, map;
myVectorLayer = new OpenLayers.Layer.Vector(
myLayerName,
{
protocol: new OpenLayers.Protocol.HTTP({
url: myUrl,
format: new OpenLayers.Format.GPX()
}),
strategies: [new OpenLayers.Strategy.Fixed()],
displayInLayerSwitcher: false,
style: {strokeColor: "blue", strokeWidth: 4, strokeOpacity: 0.5},
projection: new OpenLayers.Projection("EPSG:4326")
}
);
myVectorLayer.setVisibility(true);
map.addLayer(myVectorLayer);
}
My function setNewUrl() doesn’t work.
I can’t find the correct solution in openLayers sources.
Which function reads the file after changing url? What is here wrong?
Thanks Hareck
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users