From df4353a3bd0cb82ec67ffee25b823e385bfe08fa Mon Sep 17 00:00:00 2001 From: Qiusheng Wu Date: Mon, 24 Jun 2024 11:22:13 -0400 Subject: [PATCH] Fix add_geojson paint bug (#788) * Fix add_geojson paint bug * Fix geodataset error * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- docs/notebooks/13_geopandas.ipynb | 16 ++++++++++++++- docs/workshops/FOSS4G_2021.ipynb | 4 +++- docs/workshops/YouthMappers_2021.ipynb | 4 +++- examples/notebooks/13_geopandas.ipynb | 8 +++++++- examples/workshops/FOSS4G_2021.ipynb | 4 +++- examples/workshops/YouthMappers_2021.ipynb | 4 +++- leafmap/maplibregl.py | 24 +++++++++++----------- 7 files changed, 46 insertions(+), 18 deletions(-) diff --git a/docs/notebooks/13_geopandas.ipynb b/docs/notebooks/13_geopandas.ipynb index be64ab94b1..f40f919886 100644 --- a/docs/notebooks/13_geopandas.ipynb +++ b/docs/notebooks/13_geopandas.ipynb @@ -138,7 +138,9 @@ "metadata": {}, "outputs": [], "source": [ - "path_to_data = gpd.datasets.get_path(\"nybb\")\n", + "path_to_data = (\n", + " \"https://github.com/opengeos/datasets/releases/download/vector/nybb.geojson\"\n", + ")\n", "gdf = gpd.read_file(path_to_data)\n", "gdf" ] @@ -196,6 +198,18 @@ "display_name": "Python 3", "language": "python", "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.8" } }, "nbformat": 4, diff --git a/docs/workshops/FOSS4G_2021.ipynb b/docs/workshops/FOSS4G_2021.ipynb index a839b61f2d..c89fc955fa 100644 --- a/docs/workshops/FOSS4G_2021.ipynb +++ b/docs/workshops/FOSS4G_2021.ipynb @@ -1785,7 +1785,9 @@ "metadata": {}, "outputs": [], "source": [ - "path_to_data = gpd.datasets.get_path(\"nybb\")\n", + "path_to_data = (\n", + " \"https://github.com/opengeos/datasets/releases/download/vector/nybb.geojson\"\n", + ")\n", "gdf = gpd.read_file(path_to_data)\n", "gdf" ] diff --git a/docs/workshops/YouthMappers_2021.ipynb b/docs/workshops/YouthMappers_2021.ipynb index b3be51f3e2..a2fabe5256 100644 --- a/docs/workshops/YouthMappers_2021.ipynb +++ b/docs/workshops/YouthMappers_2021.ipynb @@ -1698,7 +1698,9 @@ "metadata": {}, "outputs": [], "source": [ - "path_to_data = gpd.datasets.get_path(\"nybb\")\n", + "path_to_data = (\n", + " \"https://github.com/opengeos/datasets/releases/download/vector/nybb.geojson\"\n", + ")\n", "gdf = gpd.read_file(path_to_data)\n", "gdf" ] diff --git a/examples/notebooks/13_geopandas.ipynb b/examples/notebooks/13_geopandas.ipynb index be64ab94b1..39a5a090c7 100644 --- a/examples/notebooks/13_geopandas.ipynb +++ b/examples/notebooks/13_geopandas.ipynb @@ -138,7 +138,9 @@ "metadata": {}, "outputs": [], "source": [ - "path_to_data = gpd.datasets.get_path(\"nybb\")\n", + "path_to_data = (\n", + " \"https://github.com/opengeos/datasets/releases/download/vector/nybb.geojson\"\n", + ")\n", "gdf = gpd.read_file(path_to_data)\n", "gdf" ] @@ -196,6 +198,10 @@ "display_name": "Python 3", "language": "python", "name": "python3" + }, + "language_info": { + "name": "python", + "version": "3.1.-1" } }, "nbformat": 4, diff --git a/examples/workshops/FOSS4G_2021.ipynb b/examples/workshops/FOSS4G_2021.ipynb index a839b61f2d..c89fc955fa 100644 --- a/examples/workshops/FOSS4G_2021.ipynb +++ b/examples/workshops/FOSS4G_2021.ipynb @@ -1785,7 +1785,9 @@ "metadata": {}, "outputs": [], "source": [ - "path_to_data = gpd.datasets.get_path(\"nybb\")\n", + "path_to_data = (\n", + " \"https://github.com/opengeos/datasets/releases/download/vector/nybb.geojson\"\n", + ")\n", "gdf = gpd.read_file(path_to_data)\n", "gdf" ] diff --git a/examples/workshops/YouthMappers_2021.ipynb b/examples/workshops/YouthMappers_2021.ipynb index b3be51f3e2..a2fabe5256 100644 --- a/examples/workshops/YouthMappers_2021.ipynb +++ b/examples/workshops/YouthMappers_2021.ipynb @@ -1698,7 +1698,9 @@ "metadata": {}, "outputs": [], "source": [ - "path_to_data = gpd.datasets.get_path(\"nybb\")\n", + "path_to_data = (\n", + " \"https://github.com/opengeos/datasets/releases/download/vector/nybb.geojson\"\n", + ")\n", "gdf = gpd.read_file(path_to_data)\n", "gdf" ] diff --git a/leafmap/maplibregl.py b/leafmap/maplibregl.py index a6014db6d8..74ea579c7a 100644 --- a/leafmap/maplibregl.py +++ b/leafmap/maplibregl.py @@ -500,24 +500,24 @@ def add_geojson( if geom_type in ["Point", "MultiPoint"]: if layer_type is None: layer_type = "circle" - paint = { - "circle-radius": 5, - "circle-color": "#3388ff", - "circle-stroke-color": "#ffffff", - "circle-stroke-width": 1, - } + paint = { + "circle-radius": 5, + "circle-color": "#3388ff", + "circle-stroke-color": "#ffffff", + "circle-stroke-width": 1, + } elif geom_type in ["LineString", "MultiLineString"]: if layer_type is None: layer_type = "line" - paint = {"line-color": "#3388ff", "line-width": 2} + paint = {"line-color": "#3388ff", "line-width": 2} elif geom_type in ["Polygon", "MultiPolygon"]: if layer_type is None: layer_type = "fill" - paint = { - "fill-color": "#3388ff", - "fill-opacity": 0.8, - "fill-outline-color": "#ffffff", - } + paint = { + "fill-color": "#3388ff", + "fill-opacity": 0.8, + "fill-outline-color": "#ffffff", + } if paint is not None: kwargs["paint"] = paint