jupyter-widgets / ipyleaflet

A Jupyter - Leaflet.js bridge
https://ipyleaflet.readthedocs.io
MIT License
1.49k stars 365 forks source link

Add basemap model_id to Map._layer_ids attribute #1208

Closed giswqs closed 3 months ago

giswqs commented 3 months ago

When initializing the Map with a basemap, the basemap model_id is not added to the Map._layer_ids attribute, resulting in an error when trying to removing the basemap from the map. This PR fixes the bug by adding the basemap layer id to the Map._layer_ids attribute

import ipyleaflet
m = ipyleaflet.Map()
m
m.remove(m.layers[0])

image