|
5 | 5 | "id": "0", |
6 | 6 | "metadata": {}, |
7 | 7 | "source": [ |
8 | | - "# 👁️ 2 - Interactive visualization of raster and vector data\n", |
| 8 | + "# Interactive visualization of raster and vector data\n", |
9 | 9 | "\n", |
10 | 10 | "[](https://colab.research.google.com/github/opengeos/leafmap/blob/master/docs/workshops/AGU_2025.ipynb)\n", |
11 | 11 | "\n", |
12 | 12 | "## Introduction\n", |
13 | 13 | "\n", |
14 | | - "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", |
| 14 | + "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", |
15 | 15 | "\n", |
16 | 16 | "### Learning Objectives\n", |
17 | 17 | "\n", |
|
25 | 25 | "- Use TiTiler for dynamic raster tile serving\n", |
26 | 26 | "- Apply custom styling and legends to enhance map readability\n", |
27 | 27 | "\n", |
28 | | - "\n", |
29 | 28 | "## Useful Resources\n", |
30 | 29 | "\n", |
31 | 30 | "- [MapLibre GL JS Documentation](https://maplibre.org/maplibre-gl-js/docs): Comprehensive documentation for MapLibre GL JS.\n", |
|
34 | 33 | "- [Video Tutorials](https://bit.ly/maplibre): Video guides for practical MapLibre skills.\n", |
35 | 34 | "- [MapLibre Demos](https://maps.gishub.org): Interactive demos showcasing MapLibre's capabilities.\n", |
36 | 35 | "\n", |
37 | | - "## Table of Contents\n", |
38 | | - "\n", |
39 | | - "- [Installation and Setup](#installation-and-setup)\n", |
40 | | - "- [Creating Interactive Maps](#creating-interactive-maps)\n", |
41 | | - " - [Basic Map Setup](#basic-map-setup)\n", |
42 | | - " - [Customizing the Map's Center and Zoom Level](#customizing-the-maps-center-and-zoom-level)\n", |
43 | | - " - [Choosing a Basemap Style](#choosing-a-basemap-style)\n", |
44 | | - "- [Adding Map Controls](#adding-map-controls)\n", |
45 | | - "- [Adding Layers](#adding-layers)\n", |
46 | | - " - [Adding Basemaps](#adding-basemaps)\n", |
47 | | - " - [Adding XYZ Tile Layer](#adding-xyz-tile-layer)\n", |
48 | | - " - [Adding WMS Layer](#adding-wms-layer)\n", |
49 | | - "- [3D Terrain](#3d-terrain)\n", |
50 | | - " - [3D Terrain](#3d-terrain)\n", |
51 | | - " - [3D Buildings](#3d-buildings)\n", |
52 | | - " - [3D Indoor Mapping](#3d-indoor-mapping)\n", |
53 | | - "- [Visualizing Vector Data](#visualizing-vector-data)\n", |
54 | | - " - [Point Data](#point-data)\n", |
55 | | - " - [Line Data](#line-data)\n", |
56 | | - " - [Polygon Data](#polygon-data)\n", |
57 | | - "- [Visualizing Remote Sensing Data](#visualizing-remote-sensing-data)\n", |
58 | | - " - [Local Raster Data](#local-raster-data)\n", |
59 | | - " - [Cloud Optimized GeoTIFF (COG)](#cloud-optimized-geotiff-cog)\n", |
60 | | - " - [STAC Layer](#stac-layer)\n", |
61 | | - "- [Adding Components to the Map](#adding-components-to-the-map)\n", |
62 | | - " - [Adding Color bar](#adding-color-bar)\n", |
63 | | - " - [Adding Legend](#adding-legend)\n", |
64 | | - " - [Adding Video](#adding-video)\n", |
65 | | - "- [PMTiles](#pmtiles)\n", |
66 | | - " - [Building Footprint Data](#building-footprint-data)\n", |
67 | | - " - [Fields of The World](#fields-of-the-world)\n", |
68 | | - " - [3D PMTiles](#3d-pmtiles)\n", |
69 | | - "- [H3 Hexagonal Grid](#h3-hexagonal-grid)\n", |
70 | | - "\n", |
71 | 36 | "## Installation and Setup\n", |
72 | 37 | "\n", |
73 | 38 | "To install the required packages, uncomment and run the line below." |
|
80 | 45 | "metadata": {}, |
81 | 46 | "outputs": [], |
82 | 47 | "source": [ |
83 | | - "# %pip install -U leafmap" |
| 48 | + "# %pip install -U leafmap localtileserver rioxarray mapclassify pmtiles" |
84 | 49 | ] |
85 | 50 | }, |
86 | 51 | { |
|
679 | 644 | "metadata": {}, |
680 | 645 | "outputs": [], |
681 | 646 | "source": [ |
682 | | - "m = leafmap.Map(style=\"streets\")\n", |
| 647 | + "m = leafmap.Map()\n", |
683 | 648 | "m.add_raster(filepath, indexes=[3, 2, 1], vmin=0, vmax=100, name=\"Landsat-321\")\n", |
684 | 649 | "m.add_raster(filepath, indexes=[4, 3, 2], vmin=0, vmax=100, name=\"Landsat-432\")\n", |
685 | 650 | "m" |
|
771 | 736 | "metadata": {}, |
772 | 737 | "outputs": [], |
773 | 738 | "source": [ |
774 | | - "m = leafmap.Map(style=\"streets\")\n", |
| 739 | + "m = leafmap.Map()\n", |
775 | 740 | "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", |
776 | 741 | "m.add_stac_layer(url, bands=[\"pan\"], name=\"Panchromatic\", vmin=0, vmax=150)\n", |
777 | 742 | "m.add_stac_layer(url, bands=[\"B4\", \"B3\", \"B2\"], name=\"RGB\", vmin=0, vmax=150)\n", |
|
826 | 791 | "### Adding Color bar\n", |
827 | 792 | "\n", |
828 | 793 | "Adding a color bar enhances data interpretation. In the example:\n", |
| 794 | + "\n", |
829 | 795 | "1. A Digital Elevation Model (DEM) is displayed with a color ramp from 0 to 1500 meters.\n", |
830 | 796 | "2. `add_colorbar` method is used to create a color bar with labels, adjusting its position, opacity, and orientation for optimal readability." |
831 | 797 | ] |
|
944 | 910 | "### Adding Legend\n", |
945 | 911 | "\n", |
946 | 912 | "Custom legends help users understand data classifications. Two methods are shown:\n", |
| 913 | + "\n", |
947 | 914 | "1. Using built-in legends, such as for NLCD (National Land Cover Database) or wetland types.\n", |
948 | 915 | "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." |
949 | 916 | ] |
|
1109 | 1076 | "source": [ |
1110 | 1077 | "### Building Footprint Data\n", |
1111 | 1078 | "\n", |
1112 | | - "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." |
| 1079 | + "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." |
1113 | 1080 | ] |
1114 | 1081 | }, |
1115 | 1082 | { |
|
1446 | 1413 | "### Key Takeaways\n", |
1447 | 1414 | "\n", |
1448 | 1415 | "1. **Choose the Right Format**:\n", |
| 1416 | + "\n", |
1449 | 1417 | " - Use COGs for large raster datasets in cloud storage\n", |
1450 | 1418 | " - Use PMTiles for vector data (buildings, boundaries, points of interest)\n", |
1451 | 1419 | " - Use TiTiler when you need dynamic rendering with custom parameters\n", |
1452 | 1420 | " - Use STAC for organized collections of geospatial assets\n", |
1453 | 1421 | "\n", |
1454 | 1422 | "2. **Performance Optimization**:\n", |
| 1423 | + "\n", |
1455 | 1424 | " - Leverage cloud-native formats (COG, PMTiles) for better performance\n", |
1456 | 1425 | " - Use appropriate zoom levels and bounds to limit data loading\n", |
1457 | 1426 | " - Apply data rescaling and color mapping efficiently\n", |
1458 | 1427 | " - Consider using `before_id` parameter to control layer ordering\n", |
1459 | 1428 | "\n", |
1460 | 1429 | "3. **Visualization Best Practices**:\n", |
| 1430 | + "\n", |
1461 | 1431 | " - Add legends and color bars to make your maps interpretable\n", |
1462 | 1432 | " - Use appropriate color schemes for your data type (sequential, diverging, categorical)\n", |
1463 | 1433 | " - Leverage 3D visualizations (terrain, buildings) when appropriate\n", |
|
1483 | 1453 | } |
1484 | 1454 | ], |
1485 | 1455 | "metadata": { |
| 1456 | + "authors": [ |
| 1457 | + { |
| 1458 | + "affiliations": [ |
| 1459 | + "University of Tennessee, Knoxville" |
| 1460 | + ], |
| 1461 | + "email": "qwu18@utk.edu", |
| 1462 | + "github": "giswqs", |
| 1463 | + "name": "Qiusheng Wu", |
| 1464 | + "orcid": "0000-0001-5437-4073" |
| 1465 | + } |
| 1466 | + ], |
| 1467 | + "execute": false, |
1486 | 1468 | "jupytext": { |
1487 | 1469 | "default_lexer": "ipython3" |
1488 | 1470 | }, |
1489 | | - "kernelspec": { |
1490 | | - "display_name": "geo", |
1491 | | - "language": "python", |
1492 | | - "name": "python3" |
1493 | | - }, |
1494 | 1471 | "language_info": { |
1495 | | - "codemirror_mode": { |
1496 | | - "name": "ipython", |
1497 | | - "version": 3 |
1498 | | - }, |
1499 | | - "file_extension": ".py", |
1500 | | - "mimetype": "text/x-python", |
1501 | | - "name": "python", |
1502 | | - "nbconvert_exporter": "python", |
1503 | | - "pygments_lexer": "ipython3", |
1504 | | - "version": "3.12.9" |
| 1472 | + "name": "python" |
1505 | 1473 | } |
1506 | 1474 | }, |
1507 | 1475 | "nbformat": 4, |
|
0 commit comments