Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 24 additions & 56 deletions docs/workshops/AGU_2025.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"id": "0",
"metadata": {},
"source": [
"# 👁️ 2 - Interactive visualization of raster and vector data\n",
"# Interactive visualization of raster and vector data\n",
"\n",
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/leafmap/blob/master/docs/workshops/AGU_2025.ipynb)\n",
"\n",
"## Introduction\n",
"\n",
"This notebook is for the workshop ([Open Source Geospatial Workflows in the Cloud](https://geojupyter.github.io/workshop-open-source-geospatial)) presented at the [AGU Fall Meeting 2025](https://agu.confex.com/agu/agu25/meetingapp.cgi/Session/252640).\n",
"This notebook is for the workshop ([Open Source Geospatial Workflows in the Cloud](https://agu2025.workshops.geojupyter.org/)) presented at the [AGU Fall Meeting 2025](https://agu.confex.com/agu/agu25/meetingapp.cgi/Session/252640).\n",
"\n",
"### Learning Objectives\n",
"\n",
Expand All @@ -25,7 +25,6 @@
"- Use TiTiler for dynamic raster tile serving\n",
"- Apply custom styling and legends to enhance map readability\n",
"\n",
"\n",
"## Useful Resources\n",
"\n",
"- [MapLibre GL JS Documentation](https://maplibre.org/maplibre-gl-js/docs): Comprehensive documentation for MapLibre GL JS.\n",
Expand All @@ -34,40 +33,6 @@
"- [Video Tutorials](https://bit.ly/maplibre): Video guides for practical MapLibre skills.\n",
"- [MapLibre Demos](https://maps.gishub.org): Interactive demos showcasing MapLibre's capabilities.\n",
"\n",
"## Table of Contents\n",
"\n",
"- [Installation and Setup](#installation-and-setup)\n",
"- [Creating Interactive Maps](#creating-interactive-maps)\n",
" - [Basic Map Setup](#basic-map-setup)\n",
" - [Customizing the Map's Center and Zoom Level](#customizing-the-maps-center-and-zoom-level)\n",
" - [Choosing a Basemap Style](#choosing-a-basemap-style)\n",
"- [Adding Map Controls](#adding-map-controls)\n",
"- [Adding Layers](#adding-layers)\n",
" - [Adding Basemaps](#adding-basemaps)\n",
" - [Adding XYZ Tile Layer](#adding-xyz-tile-layer)\n",
" - [Adding WMS Layer](#adding-wms-layer)\n",
"- [3D Terrain](#3d-terrain)\n",
" - [3D Terrain](#3d-terrain)\n",
" - [3D Buildings](#3d-buildings)\n",
" - [3D Indoor Mapping](#3d-indoor-mapping)\n",
"- [Visualizing Vector Data](#visualizing-vector-data)\n",
" - [Point Data](#point-data)\n",
" - [Line Data](#line-data)\n",
" - [Polygon Data](#polygon-data)\n",
"- [Visualizing Remote Sensing Data](#visualizing-remote-sensing-data)\n",
" - [Local Raster Data](#local-raster-data)\n",
" - [Cloud Optimized GeoTIFF (COG)](#cloud-optimized-geotiff-cog)\n",
" - [STAC Layer](#stac-layer)\n",
"- [Adding Components to the Map](#adding-components-to-the-map)\n",
" - [Adding Color bar](#adding-color-bar)\n",
" - [Adding Legend](#adding-legend)\n",
" - [Adding Video](#adding-video)\n",
"- [PMTiles](#pmtiles)\n",
" - [Building Footprint Data](#building-footprint-data)\n",
" - [Fields of The World](#fields-of-the-world)\n",
" - [3D PMTiles](#3d-pmtiles)\n",
"- [H3 Hexagonal Grid](#h3-hexagonal-grid)\n",
"\n",
"## Installation and Setup\n",
"\n",
"To install the required packages, uncomment and run the line below."
Expand All @@ -80,7 +45,7 @@
"metadata": {},
"outputs": [],
"source": [
"# %pip install -U leafmap"
"# %pip install -U leafmap localtileserver rioxarray mapclassify pmtiles"
]
},
{
Expand Down Expand Up @@ -679,7 +644,7 @@
"metadata": {},
"outputs": [],
"source": [
"m = leafmap.Map(style=\"streets\")\n",
"m = leafmap.Map()\n",
"m.add_raster(filepath, indexes=[3, 2, 1], vmin=0, vmax=100, name=\"Landsat-321\")\n",
"m.add_raster(filepath, indexes=[4, 3, 2], vmin=0, vmax=100, name=\"Landsat-432\")\n",
"m"
Expand Down Expand Up @@ -771,7 +736,7 @@
"metadata": {},
"outputs": [],
"source": [
"m = leafmap.Map(style=\"streets\")\n",
"m = leafmap.Map()\n",
"url = \"https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json\"\n",
"m.add_stac_layer(url, bands=[\"pan\"], name=\"Panchromatic\", vmin=0, vmax=150)\n",
"m.add_stac_layer(url, bands=[\"B4\", \"B3\", \"B2\"], name=\"RGB\", vmin=0, vmax=150)\n",
Expand Down Expand Up @@ -826,6 +791,7 @@
"### Adding Color bar\n",
"\n",
"Adding a color bar enhances data interpretation. In the example:\n",
"\n",
"1. A Digital Elevation Model (DEM) is displayed with a color ramp from 0 to 1500 meters.\n",
"2. `add_colorbar` method is used to create a color bar with labels, adjusting its position, opacity, and orientation for optimal readability."
]
Expand Down Expand Up @@ -944,6 +910,7 @@
"### Adding Legend\n",
"\n",
"Custom legends help users understand data classifications. Two methods are shown:\n",
"\n",
"1. Using built-in legends, such as for NLCD (National Land Cover Database) or wetland types.\n",
"2. Custom legends are built with a dictionary of land cover types and colors. This legend provides descriptive color-coding for various land cover types, with configurable background opacity to blend with the map."
]
Expand Down Expand Up @@ -1109,7 +1076,7 @@
"source": [
"### Building Footprint Data\n",
"\n",
"Visualize the [Google-Microsoft Open Buildings dataset](https://beta.source.coop/repositories/vida/google-microsoft-open-buildings/description), managed by VIDA, in PMTiles format. Fetch metadata to identify available layers, apply custom styles to the building footprints, and render them with semi-transparent colors for a clear visualization."
"Visualize the [Google-Microsoft Open Buildings dataset](https://source.coop/vida/google-microsoft-osm-open-buildings), managed by VIDA, in PMTiles format. Fetch metadata to identify available layers, apply custom styles to the building footprints, and render them with semi-transparent colors for a clear visualization."
]
},
{
Expand Down Expand Up @@ -1446,18 +1413,21 @@
"### Key Takeaways\n",
"\n",
"1. **Choose the Right Format**:\n",
"\n",
" - Use COGs for large raster datasets in cloud storage\n",
" - Use PMTiles for vector data (buildings, boundaries, points of interest)\n",
" - Use TiTiler when you need dynamic rendering with custom parameters\n",
" - Use STAC for organized collections of geospatial assets\n",
"\n",
"2. **Performance Optimization**:\n",
"\n",
" - Leverage cloud-native formats (COG, PMTiles) for better performance\n",
" - Use appropriate zoom levels and bounds to limit data loading\n",
" - Apply data rescaling and color mapping efficiently\n",
" - Consider using `before_id` parameter to control layer ordering\n",
"\n",
"3. **Visualization Best Practices**:\n",
"\n",
" - Add legends and color bars to make your maps interpretable\n",
" - Use appropriate color schemes for your data type (sequential, diverging, categorical)\n",
" - Leverage 3D visualizations (terrain, buildings) when appropriate\n",
Expand All @@ -1483,25 +1453,23 @@
}
],
"metadata": {
"authors": [
{
"affiliations": [
"University of Tennessee, Knoxville"
],
"email": "qwu18@utk.edu",
"github": "giswqs",
"name": "Qiusheng Wu",
"orcid": "0000-0001-5437-4073"
}
],
"execute": false,
"jupytext": {
"default_lexer": "ipython3"
},
"kernelspec": {
"display_name": "geo",
"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.12.9"
"name": "python"
}
},
"nbformat": 4,
Expand Down