{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Accessing Cloud Optimized Data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Authors: Samuel Ayers (UAH)\n", "\n", "Date: April 28, 2021 (Revised July 2023)\n", "\n", "Description: The following is an example that uses Shuttle Radar Topography Mission (SRTM) Cloud Optimized GeoTIFF (COG) data from the MAAP data store, via MAAP STAC search. In this example, we read in elevation data using a bounding box tile." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Run This Notebook\n", "\n", "To access and run this tutorial within MAAP's Algorithm Development Environment (ADE), please refer to the \"Getting started with the MAAP\" 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": [ "## Additional Resources\n", "\n", "- [Cloud Native Geoguide](https://guide.cloudnativegeo.org/)\n", "- [Examples of Working with COGs](https://guide.cloudnativegeo.org/cloud-optimized-geotiffs/cogs-examples.html)\n", "- [Using pystac-client](https://pystac-client.readthedocs.io/en/stable/api.html)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Importing and Installing Packages" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To be able to run this notebook you'll need the following requirements:\n", "\n", "- rasterio\n", "- folium\n", "- geopandas\n", "- rio-cogeo\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If the packages below are not installed already, uncomment the following cell" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# %pip install -U folium geopandas rasterio>=1.2.3 rio-cogeo\n", "# %pip install pystac-client" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# import the maap package to handle queries\n", "from maap.maap import MAAP\n", "\n", "# invoke the MAAP\n", "maap = MAAP()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Retrieving the Data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can use pystac_client `get_collection` to retrieve the desired collection, in this case the SRTMGL1_COD collection and set the result of the function to a variable." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "