From 94459f1f466c0b7bf026f845cbe12cdcf2622c4d Mon Sep 17 00:00:00 2001 From: Qiusheng Wu Date: Wed, 4 Aug 2021 23:34:33 -0400 Subject: [PATCH] Improved folium basemaps #91 --- docs/notebooks/24_heatmap.ipynb | 2 +- examples/notebooks/00_key_features.ipynb | 4 ++-- examples/notebooks/24_heatmap.ipynb | 2 +- leafmap/basemaps.py | 22 ++++++++++++++++++++-- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/docs/notebooks/24_heatmap.ipynb b/docs/notebooks/24_heatmap.ipynb index 6562532dd7..d294cfc8e8 100644 --- a/docs/notebooks/24_heatmap.ipynb +++ b/docs/notebooks/24_heatmap.ipynb @@ -100,7 +100,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(tiles='stamentoner', google_map=None)\n", + "m = leafmap.Map(tiles='stamentoner')\n", "m.add_heatmap(filepath, latitude=\"latitude\", longitude='longitude', value=\"pop_max\", name=\"Heat map\", radius=20)\n", "m" ] diff --git a/examples/notebooks/00_key_features.ipynb b/examples/notebooks/00_key_features.ipynb index d31b2986f7..ca30e376e9 100644 --- a/examples/notebooks/00_key_features.ipynb +++ b/examples/notebooks/00_key_features.ipynb @@ -55,7 +55,7 @@ "metadata": {}, "outputs": [], "source": [ - "import leafmap" + "import leafmap.foliumap as leafmap" ] }, { @@ -71,7 +71,7 @@ "metadata": {}, "outputs": [], "source": [ - "import leafmap.foliumap as leafmap" + "import leafmap" ] }, { diff --git a/examples/notebooks/24_heatmap.ipynb b/examples/notebooks/24_heatmap.ipynb index 6562532dd7..d294cfc8e8 100644 --- a/examples/notebooks/24_heatmap.ipynb +++ b/examples/notebooks/24_heatmap.ipynb @@ -100,7 +100,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(tiles='stamentoner', google_map=None)\n", + "m = leafmap.Map(tiles='stamentoner')\n", "m.add_heatmap(filepath, latitude=\"latitude\", longitude='longitude', value=\"pop_max\", name=\"Heat map\", radius=20)\n", "m" ] diff --git a/leafmap/basemaps.py b/leafmap/basemaps.py index 9e923a2682..3c97bb5d13 100644 --- a/leafmap/basemaps.py +++ b/leafmap/basemaps.py @@ -264,7 +264,7 @@ def xyz_to_leaflet(): name = wms_tiles[key]["name"] url = wms_tiles[key]["url"] layers = wms_tiles[key]["layers"] - fnt = wms_tiles[key]["format"] + fmt = wms_tiles[key]["format"] transparent = wms_tiles[key]["transparent"] attribution = wms_tiles[key]["attribution"] leaflet_dict[key] = ipyleaflet.WMSLayer( @@ -272,7 +272,7 @@ def xyz_to_leaflet(): layers=layers, name=name, attribution=attribution, - format=fnt, + format=fmt, transparent=transparent, ) @@ -317,6 +317,24 @@ def xyz_to_folium(): control=True, ) + for key in wms_tiles: + name = wms_tiles[key]["name"] + url = wms_tiles[key]["url"] + layers = wms_tiles[key]["layers"] + fmt = wms_tiles[key]["format"] + transparent = wms_tiles[key]["transparent"] + attribution = wms_tiles[key]["attribution"] + folium_dict[key] = folium.WmsTileLayer( + url=url, + layers=layers, + name=name, + attr=attribution, + fmt=fmt, + transparent=transparent, + overlay=True, + control=True, + ) + xyz_dict = get_xyz_dict() for item in xyz_dict: name = xyz_dict[item].name