Hi all,
I wrote this code to get data from a Geojson :
var saveStrategy = new OpenLayers.Strategy.Save();
saveStrategy.events.register('success', null, saveSuccess);
saveStrategy.events.register('fail', null, saveFail);
var style_line = new OpenLayers.StyleMap({
"default": new
OpenLayers.Style(OpenLayers.Util.applyDefaults({
strokeWidth: 3,
strokeColor: "green",
pointRadius: 3
}, OpenLayers.Feature.Vector.style["default"])),
"select": new
OpenLayers.Style(OpenLayers.Util.applyDefaults({
strokeWidth: 3,
strokeColor: "red",
pointRadius: 2
}, OpenLayers.Feature.Vector.style["select"]))
});
var myprotocol = new OpenLayers.Protocol.HTTP({
format: new OpenLayers.Format.GeoJSON(),
url: "/edit/data/Line",
params: {bbox: bb[0]+","+ bb[1]+"," + bb[2]+","+bb[3]}
});
layer_line = new OpenLayers.Layer.Vector("Line", {
projection: "EPSG:4326",
strategies: [saveStrategy],
protocol:myprotocol,
styleMap: style_line
});
layer_line.protocol.read({
callback: function(resp) {
layer_line.addFeatures(resp.features);
}
});
map.addLayer(layer_line);
In firebug i write command : layer_line.features.length and it show me a
number. I think that it means that layer has feature but on map i can see the
features. Where am i wrong?
Thanks
Francesco
_______________________________________________
Dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev