Geographic Information Systems Asked on May 26, 2021
In a Leaflet map, it is possible to add features to a GeoJSON layer using the addData
method:
L.geoJSON:
Creates a GeoJSON layer. Optionally accepts an object in
GeoJSON format (you can alternatively add it later with addData
method)
addData(data)
: Adds a GeoJSON object to the layer.
Is it possible to remove all features from the GeoJSON layer, without destroying the layer and recreating it?
It seems that GeoJSON
extends FeatureGroup
, which extends LayerGroup
, which has a method clearLayers
().
This means that jsonLayer.clearLayers()
can be used to remove the features from a GeoJSON layer.
Correct answer by Stephen Lead on May 26, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP