Skip to content

Commit

Permalink
Update data viz chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Nov 15, 2023
1 parent 53770ab commit 96b9a5d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
34 changes: 32 additions & 2 deletions book/duckdb/08_data_viz.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Visualizing point data."
"## Visualizing point data"
]
},
{
Expand Down Expand Up @@ -94,7 +94,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Visualizing polygon data."
"## Visualizing polygon data"
]
},
{
Expand Down Expand Up @@ -204,6 +204,36 @@
"source": [
"![legend](https://i.imgur.com/fxzHHFN.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Visualizing multiple layers"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import leafmap.deckgl as leafmap"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"m = leafmap.Map()\n",
"countries = 'https://open.gishub.org/data/duckdb/countries.geojson'\n",
"cities = 'https://open.gishub.org/data/duckdb/cities.geojson'\n",
"m.add_vector(countries, get_fill_color='blue', opacity=0.1)\n",
"m.add_vector(cities, get_radius=20000, get_fill_color='red', opacity=0.5)\n",
"m"
]
}
],
"metadata": {
Expand Down
21 changes: 19 additions & 2 deletions book/duckdb/08_data_viz.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ kernelspec:
import leafmap
```

Visualizing point data.
## Visualizing point data

```{code-cell} ipython3
url = 'https://open.gishub.org/data/duckdb/cities.parquet'
Expand All @@ -46,7 +46,7 @@ Visualize the GeoDataFrame using [lonboard](https://github.com/developmentseed/l
leafmap.view_vector(gdf, get_radius=20000, get_fill_color='blue')
```

Visualizing polygon data.
## Visualizing polygon data

```{code-cell} ipython3
url = 'https://data.source.coop/giswqs/nwi/wetlands/DC_Wetlands.parquet'
Expand Down Expand Up @@ -99,3 +99,20 @@ leafmap.Legend(title="Wetland Type", legend_dict=color_map)
```

![legend](https://i.imgur.com/fxzHHFN.png)

+++

## Visualizing multiple layers

```{code-cell} ipython3
import leafmap.deckgl as leafmap
```

```{code-cell} ipython3
m = leafmap.Map()
countries = 'https://open.gishub.org/data/duckdb/countries.geojson'
cities = 'https://open.gishub.org/data/duckdb/cities.geojson'
m.add_vector(countries, get_fill_color='blue', opacity=0.1)
m.add_vector(cities, get_radius=20000, get_fill_color='red', opacity=0.5)
m
```

0 comments on commit 96b9a5d

Please sign in to comment.