{ "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": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import ee\n", "import geemap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If run into errors, uncomment the following line to update the package and restart the kernel to take effect." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# geemap.update_package()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "Map" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create a region of interest." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "region = ee.Geometry.Polygon(\n", " [\n", " [\n", " [-99.101934, 47.12745],\n", " [-99.101934, 47.156232],\n", " [-99.033441, 47.156232],\n", " [-99.033441, 47.12745],\n", " [-99.101934, 47.12745],\n", " ]\n", " ]\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Map.addLayer(region)\n", "Map.centerObject(region)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create a timeseries" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "collection = geemap.naip_timeseries(region, RGBN=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "images = collection.toList(collection.size())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Get image dates" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "dates = geemap.image_dates(collection).getInfo()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "size = images.size().getInfo()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Add images to the map" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "for i in range(size):\n", " image = ee.Image(images.get(i))\n", " Map.addLayer(image, {'bands': ['N', 'R', 'G']}, dates[i][:4])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create s timelapse" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "timelapse = geemap.naip_timelapse(\n", " region, out_gif=\"naip.gif\", bands=['N', 'R', 'G'], frames_per_second=3, mp4=True\n", ")\n", "geemap.show_image(timelapse)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }