Skip to content

Commit d687a55

Browse files
authored
Add support for lonboard (opengeos#588)
* Add support for lonboard * Add lonboard notebook example * Fix typo
1 parent 691d54f commit d687a55

10 files changed

+481
-13
lines changed

docs/deckgl.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# deckgl module
2+
3+
::: leafmap.deckgl

docs/notebooks/82_pmtiles.ipynb

-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
},
4141
{
4242
"cell_type": "markdown",
43-
"id": "6f3406c5",
4443
"metadata": {},
4544
"source": [
4645
"## Remote PMTiles\n",
@@ -107,7 +106,6 @@
107106
},
108107
{
109108
"cell_type": "markdown",
110-
"id": "e1166262",
111109
"metadata": {},
112110
"source": [
113111
"### Overture data"
@@ -203,7 +201,6 @@
203201
},
204202
{
205203
"cell_type": "markdown",
206-
"id": "6b9d11d9",
207204
"metadata": {},
208205
"source": [
209206
"### Source Cooperative\n",
@@ -214,7 +211,6 @@
214211
{
215212
"cell_type": "code",
216213
"execution_count": null,
217-
"id": "9c6d5f2c",
218214
"metadata": {},
219215
"outputs": [],
220216
"source": [
@@ -227,7 +223,6 @@
227223
{
228224
"cell_type": "code",
229225
"execution_count": null,
230-
"id": "2c2cfcf8",
231226
"metadata": {},
232227
"outputs": [],
233228
"source": [
@@ -268,7 +263,6 @@
268263
{
269264
"cell_type": "code",
270265
"execution_count": null,
271-
"id": "789cce99",
272266
"metadata": {},
273267
"outputs": [],
274268
"source": [

docs/notebooks/83_vector_viz.ipynb

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"[![image](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://demo.leafmap.org/lab/index.html?path=notebooks/83_vector_viz.ipynb)\n",
8+
"[![image](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/opengeos/leafmap/blob/master/examples/notebooks/83_vector_viz.ipynb)\n",
9+
"[![image](https://img.shields.io/badge/Open-Planetary%20Computer-black?style=flat&logo=microsoft)](https://pccompute.westeurope.cloudapp.azure.com/compute/hub/user-redirect/git-pull?repo=https://github.com/opengeos/leafmap&urlpath=lab/tree/leafmap/examples/notebooks/83_vector_viz.ipynb&branch=master)\n",
10+
"[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/opengeos/leafmap/blob/master/examples/notebooks/01_leafmap_intro.ipynb)\n",
11+
"[![image](https://mybinder.org/badge_logo.svg)](https://gishub.org/leafmap-binder)\n",
12+
"\n",
13+
"**Visualizing large vector datasets with lonboard**\n",
14+
"\n",
15+
"This notebook demonstrates how to visualize large vector datasets with [lonboard](https://github.com/developmentseed/lonboard). Please note that lonboard does not support Visual Studio Code's interactive notebook yet. You will need to run this notebook in Jupyter Notebook or JupyterLab.\n",
16+
"\n",
17+
"Uncomment the following line to install [leafmap](https://leafmap.org) if needed."
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": null,
23+
"metadata": {},
24+
"outputs": [],
25+
"source": [
26+
"# %pip install -U leafmap lonboard"
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": null,
32+
"metadata": {
33+
"tags": []
34+
},
35+
"outputs": [],
36+
"source": [
37+
"import leafmap.deckgl as leafmap\n",
38+
"import geopandas as gpd"
39+
]
40+
},
41+
{
42+
"cell_type": "markdown",
43+
"metadata": {},
44+
"source": [
45+
"Download sample datasets."
46+
]
47+
},
48+
{
49+
"cell_type": "code",
50+
"execution_count": null,
51+
"metadata": {
52+
"tags": []
53+
},
54+
"outputs": [],
55+
"source": [
56+
"url = \"https://open.gishub.org/data/duckdb/nyc_data.zip\"\n",
57+
"leafmap.download_file(url, unzip=True)"
58+
]
59+
},
60+
{
61+
"cell_type": "markdown",
62+
"metadata": {},
63+
"source": [
64+
"Create an interactive map."
65+
]
66+
},
67+
{
68+
"cell_type": "code",
69+
"execution_count": null,
70+
"metadata": {
71+
"tags": []
72+
},
73+
"outputs": [],
74+
"source": [
75+
"m = leafmap.Map(center=[20, 0], zoom=1.2)\n",
76+
"m"
77+
]
78+
},
79+
{
80+
"cell_type": "markdown",
81+
"metadata": {},
82+
"source": [
83+
"Add GeoDataFrame."
84+
]
85+
},
86+
{
87+
"cell_type": "code",
88+
"execution_count": null,
89+
"metadata": {
90+
"tags": []
91+
},
92+
"outputs": [],
93+
"source": [
94+
"streets = gpd.read_file('nyc_streets.shp')\n",
95+
"m.add_gdf(streets, zoom_to_layer=True, pickable=True, get_width=5)"
96+
]
97+
},
98+
{
99+
"cell_type": "markdown",
100+
"metadata": {},
101+
"source": [
102+
"Add any vector format supported by GeoPandas."
103+
]
104+
},
105+
{
106+
"cell_type": "code",
107+
"execution_count": null,
108+
"metadata": {
109+
"tags": []
110+
},
111+
"outputs": [],
112+
"source": [
113+
"m.add_vector('nyc_subway_stations.shp', get_radius=10, get_fill_color=[255, 0, 0, 180])"
114+
]
115+
},
116+
{
117+
"cell_type": "markdown",
118+
"metadata": {},
119+
"source": [
120+
"Change layer properties."
121+
]
122+
},
123+
{
124+
"cell_type": "code",
125+
"execution_count": null,
126+
"metadata": {
127+
"tags": []
128+
},
129+
"outputs": [],
130+
"source": [
131+
"m.layers[-1].get_fill_color = [0, 0, 255, 255]"
132+
]
133+
}
134+
],
135+
"metadata": {
136+
"kernelspec": {
137+
"display_name": "Python 3 (ipykernel)",
138+
"language": "python",
139+
"name": "python3"
140+
},
141+
"language_info": {
142+
"codemirror_mode": {
143+
"name": "ipython",
144+
"version": 3
145+
},
146+
"file_extension": ".py",
147+
"mimetype": "text/x-python",
148+
"name": "python",
149+
"nbconvert_exporter": "python",
150+
"pygments_lexer": "ipython3",
151+
"version": "3.11.5"
152+
}
153+
},
154+
"nbformat": 4,
155+
"nbformat_minor": 5
156+
}

docs/tutorials.md

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
80. Visualizing solar radiation data from Google Solar API ([notebook](https://leafmap.org/notebooks/80_solar))
9797
81. Downloading Microsoft and Google Building Footprints ([notebook](https://leafmap.org/notebooks/81_buildings))
9898
82. Visualizing PMTiles with leafmap ([notebook](https://leafmap.org/notebooks/82_pmtiles))
99+
83. Visualizing large vector datasets with lonboard ([notebook](https://leafmap.org/notebooks/83_vector_viz))
99100

100101
## Demo
101102

examples/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
80. Visualizing solar radiation data from Google Solar API ([notebook](https://leafmap.org/notebooks/80_solar))
104104
81. Downloading Microsoft and Google Building Footprints ([notebook](https://leafmap.org/notebooks/81_buildings))
105105
82. Visualizing PMTiles with leafmap ([notebook](https://leafmap.org/notebooks/82_pmtiles))
106+
83. Visualizing large vector datasets with lonboard ([notebook](https://leafmap.org/notebooks/83_vector_viz))
106107

107108
## Demo
108109

examples/notebooks/82_pmtiles.ipynb

+1-7
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
},
4141
{
4242
"cell_type": "markdown",
43-
"id": "6f3406c5",
4443
"metadata": {},
4544
"source": [
4645
"## Remote PMTiles\n",
@@ -107,7 +106,6 @@
107106
},
108107
{
109108
"cell_type": "markdown",
110-
"id": "e1166262",
111109
"metadata": {},
112110
"source": [
113111
"### Overture data"
@@ -203,7 +201,6 @@
203201
},
204202
{
205203
"cell_type": "markdown",
206-
"id": "6b9d11d9",
207204
"metadata": {},
208205
"source": [
209206
"### Source Cooperative\n",
@@ -214,7 +211,6 @@
214211
{
215212
"cell_type": "code",
216213
"execution_count": null,
217-
"id": "9c6d5f2c",
218214
"metadata": {},
219215
"outputs": [],
220216
"source": [
@@ -227,7 +223,6 @@
227223
{
228224
"cell_type": "code",
229225
"execution_count": null,
230-
"id": "2c2cfcf8",
231226
"metadata": {},
232227
"outputs": [],
233228
"source": [
@@ -268,7 +263,6 @@
268263
{
269264
"cell_type": "code",
270265
"execution_count": null,
271-
"id": "789cce99",
272266
"metadata": {},
273267
"outputs": [],
274268
"source": [
@@ -411,7 +405,7 @@
411405
"name": "python",
412406
"nbconvert_exporter": "python",
413407
"pygments_lexer": "ipython3",
414-
"version": "3.10.12"
408+
"version": "3.11.5"
415409
}
416410
},
417411
"nbformat": 4,

0 commit comments

Comments
 (0)