Skip to content

How to clear markercluster #275

@Ereaey

Description

@Ereaey

Hello,

I’m using Nuxt 3 with the nuxt-modules/leaflet module (and the leaflet.markercluster plugin enabled) to display markers on a map.
I have implemented marker clustering using the useLMarkerCluster composable, and it’s working very well for adding markers.

However, I’m having trouble clearing all markers before adding new ones. So far, I’ve tried:

  • Removing the cluster group from the map using map.removeLayer(markerCluster)
  • Using markerCluster.clearLayers() on the cluster group

What is the recommended way to completely clear all markers in this context?

Any help or code examples would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions