I noticed a weird behaviour when creating maps with ipyleaflet. Every time I create an ipyleaflet map and want to save it as an html file the resulting file gets iteratively bigger and bigger in memory. When checking the resulting html file I recognized, that the layers and also all control elements get not substituted but duplicated every time I save a map.
As I am running something similiar in a for loop the files need consequently a huge amount memory space. I attached a simple script to reproduce the problem:
from ipyleaflet import Map, LayersControl, GeoData
from shapely import Point
from geopandas import GeoDataFrame
# Create a dummy GeoDataFrame
points = GeoDataFrame(geometry = [Point(3.01331, 50.97503),
Point(2.67155, 51.13195),
Point(2.81919, 51.18672),
Point(2.81795, 51.18855),
Point(3.13164, 51.02534),
Point(2.74758, 50.79735),
Point(2.64778, 51.10591),
Point(2.63007, 51.09972),
Point(2.66865, 51.07438),
Point(2.74761, 50.72729)],
crs = 4326)
# Convert GeoDataFrame to ipyleaflet Geo_Dataframe
points = GeoData(geo_dataframe=points,
point_style={'radius': 5, 'fillColor': 'blue','weight': 3},
name = 'Points')
# Initialize ipyleaflet map
m = Map(center=(50.95350377279631, 2.8110499565836227), zoom=10)
m.layout.width = '50%'
m.layout.height = '700px'
m.add_control(LayersControl(position="topright"))
# Add Geo_Dataframe to map
m.add_layer(points)
# Save as html
m.save("Map.html")
I noticed a weird behaviour when creating maps with ipyleaflet. Every time I create an ipyleaflet map and want to save it as an html file the resulting file gets iteratively bigger and bigger in memory. When checking the resulting html file I recognized, that the layers and also all control elements get not substituted but duplicated every time I save a map. As I am running something similiar in a for loop the files need consequently a huge amount memory space. I attached a simple script to reproduce the problem: