I have an Openlayers 3 app and users can retrieve stored routes from a web service and display them on a map. Currently each route is added to the top of the index but I'd like them to be inserted into an existing Layer Group.
I've tried using these to methods so far but to no avail:
var collection = map.getLayerGroup(plannerLayers);
collection.push(loadedRoute);
map.addLayer(loadedRoute); // this is the only method which works
map.getLayerGroup(plannerLayers).addLayer(loadedRoute);
Layer management in general is something I seem to be struggling with and ideally I'd like to just be able to interrogate the map for vector layers and add discrete functionality to them. Is there a way to programmatically add/remove layers to a group or even move between groups?
No comments:
Post a Comment