{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "\"Open\n", "\n", "Uncomment the following line to install [geemap](https://geemap.org) if needed." ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "# !pip install geemap" ] }, { "cell_type": "markdown", "id": "2", "metadata": {}, "source": [ "# How to select features by location and attribute?" ] }, { "cell_type": "markdown", "id": "3", "metadata": { "toc": true }, "source": [ "

Table of Contents

\n", "
" ] }, { "cell_type": "markdown", "id": "4", "metadata": {}, "source": [ "## Create an interactive map" ] }, { "cell_type": "code", "execution_count": null, "id": "5", "metadata": {}, "outputs": [], "source": [ "import ee\n", "import geemap" ] }, { "cell_type": "markdown", "id": "6", "metadata": {}, "source": [ "## Add a FeatureCollection to the map" ] }, { "cell_type": "markdown", "id": "7", "metadata": {}, "source": [ "Add a FeatureCollection from the Earth Engine Data Catalog" ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": {}, "outputs": [], "source": [ "states = ee.FeatureCollection(\"TIGER/2018/States\")\n", "Map.addLayer(states, {}, \"TIGER/2018/States\")" ] }, { "cell_type": "markdown", "id": "9", "metadata": {}, "source": [ "Load a shapefile stored locally and convert it to ee.FeatureCollection" ] }, { "cell_type": "code", "execution_count": null, "id": "10", "metadata": {}, "outputs": [], "source": [ "shp_path = \"../data/us_states.shp\"\n", "states_shp = geemap.shp_to_ee(shp_path)\n", "Map.addLayer(states_shp, {}, \"US States SHP\")" ] }, { "cell_type": "markdown", "id": "11", "metadata": {}, "source": [ "Display the vector outline only" ] }, { "cell_type": "code", "execution_count": null, "id": "12", "metadata": {}, "outputs": [], "source": [ "Map.addLayer(ee.Image().paint(states, 0, 2), {\"palette\": \"red\"}, \"US States Image\")" ] }, { "cell_type": "markdown", "id": "13", "metadata": {}, "source": [ "## Select by attribute" ] }, { "cell_type": "code", "execution_count": null, "id": "14", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "15", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "Map" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }