Troubles deleting marker after zoom in Leaflet

I have troubles deleting leaflet marker after zoom in Leafletjs. Using the newest leaflet version (1.8) and Geoserver vector tiles (Countries point layer):

var pbfLayer1 = L.vectorGrid.protobuf(url1, vectorTileOptions1).addTo(map);
var vectorTileOptions1 = {
                vectorTileLayerStyles: { pane: 'labelcity', interactive: true, 
lander:     function(properties, zoom) { var markerid =; 
 markerland[markerid] = L.marker([, properties.lon], { icon: L.divIcon({ iconUrl: null, iconSize: [0, 0], iconAnchor: [0, 0], popupAnchor: [0, 0], html: properties.name_de, className: 'landerlabel' })  }).addTo(markerGroup);   }

Trying to remove all the labels when zooming:


Tried it with moveend, zoomstart, zoom and zoomend, but it doesn´t remove all the labels. Especially after zoom out multiple zooms. For example from Zoom 5 to Zoom 2 with mouse wheel. And mostly the marker outside of the viewport are still visible…

How can I fix this? Or is there still another way to label vector points in leaflet without creating a marker?

Thank you very much!

I think you are in the wrong forum

would make more sense

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.