{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\"Open\n", "\n", "Uncomment the following line to install [geemap](https://geemap.org) if needed." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# !pip install geemap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## How to download image thumbnails from an ImageCollection" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "import ee\n", "import geemap" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "roi = ee.Geometry.Point([-122.44, 37.75])\n", "collection = (\n", " ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')\n", " .filterBounds(roi)\n", " .sort(\"CLOUD_COVER\")\n", " .limit(10)\n", ")\n", "\n", "image = collection.first()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "vis_params = {\n", " 'bands': ['B6', 'B5', 'B4'],\n", " 'min': 0,\n", " 'max': 6000,\n", " 'gamma': 1.4,\n", "}\n", "\n", "Map.addLayer(image, vis_params, \"LANDSAT 7\")\n", "Map.setCenter(-122.44, 37.75, 8)\n", "Map" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "out_img = os.path.expanduser(\"~/Downloads/landsat.png\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "geemap.get_image_thumbnail(image, out_img, vis_params, dimensions=500, format='png')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "geemap.show_image(out_img)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "out_dir = os.path.expanduser(\"~/Downloads\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "geemap.get_image_collection_thumbnails(\n", " collection, out_dir, vis_params, dimensions=500, format=\"jpg\"\n", ")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }