{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\"Open\n", "\n", "**Download Earth Engine map tiles as a GeoTIFF**\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 -U geemap" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import ee\n", "import geemap" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "point = ee.Geometry.Point(-99.2222, 46.7816)\n", "collection = (\n", " ee.ImageCollection('USDA/NAIP/DOQQ')\n", " .filterBounds(point)\n", " .filterDate('2008-01-01', '2018-01-01')\n", " .filter(ee.Filter.listContains(\"system:band_names\", \"N\"))\n", ")\n", "image = collection.first()\n", "Map.addLayer(image, {}, 'NAIP')\n", "Map.centerObject(image)\n", "Map" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "geemap.ee_to_geotiff(\n", " image, 'naip.tif', resolution=5, vis_params={'bands': ['N', 'R', 'G']}\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "\n", "image = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318').select(\n", " ['B5', 'B4', 'B3']\n", ")\n", "\n", "vis_params = {'min': 0, 'max': 0.5, 'gamma': [0.95, 1.1, 1]}\n", "\n", "Map.centerObject(image)\n", "Map.addLayer(image, vis_params, 'Landsat')\n", "Map" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "bbox = Map.user_roi_coords()\n", "if bbox is None:\n", " bbox = [-122.5955, 37.5339, -122.0982, 37.8252]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "geemap.ee_to_geotiff(image, 'landsat.tif', bbox, vis_params, resolution=30)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }