0

I'm having a problem using Leaflet 1.2.0 with WFS and control Layers, WFS works fine, however when I use it with control.layers (see code bellow) it does not work and it returns an error:

Uncaught TypeError: Can not read property 'minZoom' of undefined

If using with version 0.6 works but I can not use it because of its limitations. Can someone please help me?

The code is here in git: https://github.com/eltonsantos/leaflet-tests/blob/master/teste14/index.html

and here in jsfiddle: https://jsfiddle.net/eltin182/amg80r7j/3/

Elton Santos
  • 571
  • 6
  • 32

1 Answers1

0

You are building a plain JS object:

var stComerciaisLayer = {
  service: 'WFS',
  // etc.
};

…and try to feed it into the Leaflet Layers Control:

var objCamadas = {
  "Setores Comerciais": stComerciaisLayer
}

L.control.layers(baseLayers, objCamadas).addTo(map);

…whereas the Layers Control is supposed to handle Leaflet layers, not plain JS objects.

There should be some Leaflet plugins to handle WFS, have a look on the plugins page.

ghybs
  • 47,565
  • 6
  • 74
  • 99