I want to redraw an OpenLayers vector.
my html button:
<button id="refresh" type="button">Refresh</button>
and my jquery functions to redraw the layer, the parksLayer in the refresh function is logging as false:
function refresh() {
parksLayer.redraw(true);
}
function bind(){
$("#refresh").bind("click", refresh);
}
and my map, I want to redraw the ParksLayer:
map = new OpenLayers.Map({
div: "map",
layers: [
new OpenLayers.Layer.OSM(),
parksLayer
]
});
UPDATE
Thanks for the help, my vector layer is defined like this:
function changeme(avalue){
parksLayer = new OpenLayers.Layer.Vector("Parks", {
projection: new OpenLayers.Projection("EPSG:4326"),
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.Script({
url: "http://my.cartodb.com/api/v2/sql",
params: {
q: "SELECT * FROM activities where type_code is not null"+" "+avalue,
format: "geojson"
},
format: new OpenLayers.Format.GeoJSON({
ignoreExtraDims: true
}),
callbackKey: "callback"
}),
});
}
I have a form that changes avalue dynamically which changes the GeoJSON query, so if I could redraw the parksLayer I would be left with a new selection from the layer.