Skip to content

how to add l-layer-group overlay as unchecked #492

@C00Lzero

Description

@C00Lzero

sorry, if i write this here, even if it's not a bug. I'm new to vue (and are using quasar).

How can I add a layer-group that is disabled but visible?
What I mean:
How can I add this to the control, but don't have it activated (checkbox not checked)

I have to load around 10k Elements in different layers.
If I would load them all at once, you won't see anything.

In 'pure' Javascript I did it like this:

var cities = L.layerGroup();
L.marker([52.369072,9.722780], {icon: homeIcon}).addTo(cities);

...

var overlayControl = L.control.layers(null, null,{collapsed:false});
  overlayControl.addOverlay(cities, "Cities");
  overlayControl.addOverlay(areas, "Areas");
  
  overlayControl.addTo(map);

So none of the Layers are activated per default.
Is there a way to get this somehow in vue?

<l-layer-group>
        <l-layer-group layer-type="overlay" name="Cities" :visible="true">
          <l-marker
            v-for="marker in markers"
            :key="marker.id"
            :visible="marker.visible"
            :lat-lng="marker.position"
            :icon="iconHome">
            <l-popup :content="marker.popuptext" />
          </l-marker>
        </l-layer-group>

        <l-layer-group layer-type="overlay" name="geoJSON" :visible="true" >
           <l-geo-json
              :geojson="geojsontxt"
              :options="options"
              :options-style="styleFunction"
            />
        </l-layer-group>
</l-layer-group>

or do I have to generate it in mounted() -> this.$nextTick using my leaflet-Import?

Versions

  • Leaflet: v1.6.0
  • Vue: v2.6.10
  • Vue2Leaflet: v2.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions