1

I have a problem with Matt Walker's LayerSwitcher on my map construct. I use fetch () to get a WFS. Unfortunately, the LayerSwitcher does not respond to the vector and nothing is displayed in the switcher. Has anyone had experience with this switcher?

fetch('[WFS-URL]').then(function(response) {
    return response.json().then(function(polygon) {...
  • That's not enough code to guess what's wrong. – TomazicM Apr 12 at 16:26
2

In order for the layer to show up in the layer switcher it must first be added to the map as per https://openlayers.org/en/latest/examples/vector-wfs.html.

In addition you'll need to add a 'title' property to the layer, see the examples: https://github.com/walkermatt/ol-layerswitcher/blob/master/examples/layerswitcher.js#L46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.