I have a map with 4-5 vectors. At the beginning, the loading of the web application is very very slow, but was fine before I've added a new one vector, which is used only for little zooms.
Is it possible to launch the loading of a vector only when the specific zoom is reached?
I'm currently using OpenLayers 2.2, and as a beginner in OpenLayers, the only way I found to load a vector was like this:
var olmap = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM({
url: 'php/map/getOsm.php?z={z}&x={x}&y={y}'
})
}), vector, vector_country, vector_countryName, vector_term, vector_port, vector_ramp
],
renderer: ol.RendererHint.CANVAS,
overlays: [overlay],
controls: ol.control.defaults().extend([
new ol.control.FullScreen(), new app.CustomExport()
]),
view: mapView
});
That was quite easy :
olmap.addLayer(nameofthelayer);