{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Visualizing MAAP STAC Dataset with MosaicJSON\n", "\n", "Authors: Samuel Ayers (UAH), Alex Mandel (Development Seed), Aimee Barciauskas (Development Seed)\n", "\n", "Date: July 23, 2021\n", "\n", "Description: In this notebook, we visualize SRTM Cloud-Optimized GeoTIFFs (COGs) from MAAP's STAC using a generated mosaic from MAAP's TiTiler." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Run This Notebook\n", "To access and run this tutorial within MAAP's Algorithm Development Environment (ADE), please refer to the [\"Getting started with the MAAP\"](https://docs.maap-project.org/en/latest/getting_started/getting_started.html) section of our documentation.\n", "\n", "Disclaimer: it is highly recommended to run a tutorial within MAAP's ADE, which already includes packages specific to MAAP, such as maap-py. Running the tutorial outside of the MAAP ADE may lead to errors." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Note About the Data\n", "\n", "The NASA Shuttle Radar Topographic Mission (SRTM) has provided digital elevation data (DEMs) for over 80% of the globe. This data is currently distributed free of charge by USGS and is available for download from the National Map Seamless Data Distribution System, or the USGS FTP site.\n", "\n", "At MAAP, we've converted this elevation data into Cloud-Optimized GeoTIFFs (COGs) so they can be efficiently queried and visualized. These COGs are available in the [MAAP STAC](https://stac.maap-project.org/collections/SRTMGL1_COD/items)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Additional Resources\n", "- [USGS EROS Archive - Shuttle Radar Topography Mission (SRTM)](https://www.usgs.gov/centers/eros/science/usgs-eros-archive-digital-elevation-shuttle-radar-topography-mission-srtm)\n", "- [TiTiler API Documentation - MosaicJSON](https://titiler.maap-project.org/docs#/MosaicJSON)\n", "- [Github - MosaicJSON](https://github.com/developmentseed/mosaicjson-spec)\n", "- [Working with MosaicJSON - TiTiler (Development Seed Example)](https://developmentseed.org/titiler/examples/notebooks/Working_with_MosaicJSON/)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Importing and Installing Packages\n", "\n", "To be able to run this notebook you'll need the following requirements:\n", "\n", "- rasterio\n", "- folium\n", "- requests\n", "- pystac-client\n", "- cogeo-mosaic (Optional)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If the packages below are not installed already, uncomment the following cell:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "tags": [] }, "outputs": [], "source": [ "# %pip install rasterio\n", "# %pip install folium\n", "# %pip install requests\n", "# %pip install pystac-client\n", "# %pip install cogeo-mosaic --pre" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "tags": [] }, "outputs": [], "source": [ "import requests\n", "\n", "from pystac_client import Client\n", "\n", "from pprint import pprint\n", "\n", "from rasterio.features import bounds as featureBounds\n", "\n", "from folium import Map, TileLayer, GeoJson" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Fetch SRTM COG STAC Items" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "tags": [] }, "outputs": [], "source": [ "cat = Client.open('https://stac.maap-project.org/')\n", "\n", "items = list(\n", " cat.search(\n", " collections=\"SRTMGL1_COD\",\n", " bbox=[4, 42, 16, 48],\n", " max_items=120\n", " ).items_as_dicts(),\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Map the Data Bounds" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "