Skip to content

Commit

Permalink
Fix add_geojson paint bug (opengeos#788)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
giswqs and pre-commit-ci[bot] authored Jun 24, 2024
1 parent 9225f5c commit dcade35
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 18 deletions.
16 changes: 15 additions & 1 deletion docs/notebooks/13_geopandas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion docs/workshops/FOSS4G_2021.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down
4 changes: 3 additions & 1 deletion docs/workshops/YouthMappers_2021.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down
8 changes: 7 additions & 1 deletion examples/notebooks/13_geopandas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down Expand Up @@ -196,6 +198,10 @@
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.1.-1"
}
},
"nbformat": 4,
Expand Down
4 changes: 3 additions & 1 deletion examples/workshops/FOSS4G_2021.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down
4 changes: 3 additions & 1 deletion examples/workshops/YouthMappers_2021.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down
24 changes: 12 additions & 12 deletions leafmap/maplibregl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dcade35

Please sign in to comment.