Vue2leaflet: Problem with multiple layers

Created on 13 Feb 2018  路  3Comments  路  Source: vue-leaflet/Vue2Leaflet

Hi,

I'm trying use WMSTileLayers.vue component but I can't use correctly it.
I tried adapt this: https://github.com/KoRiGaN/Vue2Leaflet/blob/master/examples/src/components/WMSLayers.vue

but I don't know how to get this effect:

mounted() {
    const baseMaps = {
      "Street": L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{
        maxZoom: 22,
      }),

      "Satellite": L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',{
        maxZoom: 20,
        subdomains: ['mt0','mt1','mt2','mt3']
      }),
    };

    L.control.layers(baseMaps).addTo(this.$refs.map.mapObject);
}

Could you help me?

Versions

  • Vue: v2.5.7
  • Vue2Leaflet: v0.0.58

Most helpful comment

Hi @mits87,

WMSTileLayers is for WMSLayers not for TileLayers like they have specific options like layers and just automatically create WMSLayers and the associated layer control.

I'm not sure what you are trying to achieve but if you just want to have 2 layers displayed and a control to select one or the other I would suggest just to add TileLayer and add a control manually.

If that work then you can just wrap all that into a component that will look like WMSTileLayers.

Layer controls should be implemented soon and should help with this kind of situations.

Hope this helps.

Micka

All 3 comments

Hi @mits87,

WMSTileLayers is for WMSLayers not for TileLayers like they have specific options like layers and just automatically create WMSLayers and the associated layer control.

I'm not sure what you are trying to achieve but if you just want to have 2 layers displayed and a control to select one or the other I would suggest just to add TileLayer and add a control manually.

If that work then you can just wrap all that into a component that will look like WMSTileLayers.

Layer controls should be implemented soon and should help with this kind of situations.

Hope this helps.

Micka

Hi @mits87, @ilmars, @kesm0,

Layers control is now implemented Vue2Leaflet v1.0.1.
The documentation is not good yet but you can have a look at the new WMSTileLayer example that uses the new Layers control.

WMSTileLayers control doesn't existe anymore.

Hope this helps,

Micka

Closing as no comments for 3 weeks.
Please reopen this issue if it not solved yet.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CharlesOkwuagwu picture CharlesOkwuagwu  路  5Comments

mawieutc picture mawieutc  路  4Comments

rhoseno98 picture rhoseno98  路  4Comments

hoticer picture hoticer  路  3Comments

rSammy picture rSammy  路  3Comments