I have a map with a Vector layer, containing features from a GeoJSON source:
var map = new ol.Map({ layers: [new ol.layer.Tile({ source: new ol.source.OSM() }), new ol.layer.Vector({ source: new ol.source.Vector({ url: 'http://example.com:5000/geo/data/zones/1', format: new ol.format.GeoJSON() }), })], renderer: 'canvas', target: 'map', view: new ol.View({ center: [737514.438475665, 5864533.629390752], zoom: 13 })});I have multiple URLs that returns s GeoJSON string:
I have tried to find the 'url' property on the ol.Layer.Vector instance:
l=m.getLayers().getArray()[1]l.getProperties()and on the ol.source.Vector instance:
s = l.getSource()s.getProperties()but I haven't found anything about the 'url' property.
Could you provide a way to do that ?
أكثر...
var map = new ol.Map({ layers: [new ol.layer.Tile({ source: new ol.source.OSM() }), new ol.layer.Vector({ source: new ol.source.Vector({ url: 'http://example.com:5000/geo/data/zones/1', format: new ol.format.GeoJSON() }), })], renderer: 'canvas', target: 'map', view: new ol.View({ center: [737514.438475665, 5864533.629390752], zoom: 13 })});I have multiple URLs that returns s GeoJSON string:
- http://example.com:5000/geo/data/zones/1
- http://example.com:5000/geo/data/zones/2
- http://example.com:5000/geo/data/zones/n
I have tried to find the 'url' property on the ol.Layer.Vector instance:
l=m.getLayers().getArray()[1]l.getProperties()and on the ol.source.Vector instance:
s = l.getSource()s.getProperties()but I haven't found anything about the 'url' property.
Could you provide a way to do that ?
- is it possible to simply update the source URL (and automagically refresh the layer features) ?
- shall I remove existing features, load new features using my own logic and add the loaded ones ?
- shall I remove the whole Layer, re-create it, and re-add it ?
أكثر...