Skip to content

Commit 57cdd60

Browse files
Add a download module (#1057)
* Add a download module * [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>
1 parent 99d8ba7 commit 57cdd60

6 files changed

Lines changed: 1150 additions & 13 deletions

File tree

docs/download.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# download module
2+
3+
::: leafmap.download

docs/maplibre/choropleth.ipynb

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,6 @@
126126
"id": "8",
127127
"metadata": {},
128128
"outputs": [],
129-
"source": []
130-
},
131-
{
132-
"cell_type": "code",
133-
"execution_count": null,
134-
"id": "9",
135-
"metadata": {},
136-
"outputs": [],
137129
"source": [
138130
"m = leafmap.Map(style=\"liberty\")\n",
139131
"m.add_data(\n",
@@ -152,7 +144,7 @@
152144
{
153145
"cell_type": "code",
154146
"execution_count": null,
155-
"id": "10",
147+
"id": "9",
156148
"metadata": {},
157149
"outputs": [],
158150
"source": [
@@ -173,7 +165,7 @@
173165
{
174166
"cell_type": "code",
175167
"execution_count": null,
176-
"id": "11",
168+
"id": "10",
177169
"metadata": {},
178170
"outputs": [],
179171
"source": [
@@ -194,7 +186,7 @@
194186
{
195187
"cell_type": "code",
196188
"execution_count": null,
197-
"id": "12",
189+
"id": "11",
198190
"metadata": {},
199191
"outputs": [],
200192
"source": [

docs/maplibre/overview.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Use the upcase and downcase expressions to change the case of labels.
186186

187187
Create choropleth maps with a variety of classification schemes.
188188

189-
[![](https://github.com/user-attachments/assets/35ca3e17-956e-4d88-9e24-7e94c9e322f8)](https://leafmap.org/maplibre/change_case_of_labels)
189+
[![](https://github.com/user-attachments/assets/35ca3e17-956e-4d88-9e24-7e94c9e322f8)](https://leafmap.org/maplibre/choropleth)
190190

191191
## Cloud Optimized GeoTIFF (COG)
192192

@@ -212,7 +212,6 @@ Utilize and refine data from the MapTiler Countries to create a Choropleth map o
212212

213213
[![](https://i.imgur.com/k1d6k9I.png)](https://leafmap.org/maplibre/countries_filter)
214214

215-
216215
## Create vector data
217216

218217
Create vector data interactively on a map.

leafmap/common.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8689,6 +8689,7 @@ def zonal_stats(
86898689

86908690
import geopandas as gpd
86918691
import rasterio
8692+
import xarray as xr
86928693

86938694
try:
86948695
import rasterstats
@@ -8708,6 +8709,9 @@ def zonal_stats(
87088709
nodata = raster.nodata
87098710
array = raster.read(band_num, masked=True)
87108711
raster_crs = raster.crs
8712+
elif isinstance(raster, xr.DataArray):
8713+
array = raster
8714+
raster_crs = raster.rio.crs
87118715
else:
87128716
array = raster
87138717

0 commit comments

Comments
 (0)