{ "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": "code", "execution_count": null, "id": "2", "metadata": {}, "outputs": [], "source": [ "import ee\n", "import geemap" ] }, { "cell_type": "markdown", "id": "3", "metadata": {}, "source": [ "Add data to the map." ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "countries = ee.FeatureCollection(\"users/giswqs/public/countries\")\n", "Map.addLayer(countries, {}, \"Countries\")\n", "Map" ] }, { "cell_type": "markdown", "id": "5", "metadata": {}, "source": [ "Display the attribute table." ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": {}, "outputs": [], "source": [ "geemap.ee_to_df(countries)" ] }, { "cell_type": "markdown", "id": "7", "metadata": {}, "source": [ "Get data to be joined to the attribute table." ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": {}, "outputs": [], "source": [ "data = \"https://raw.githubusercontent.com/gee-community/geemap/master/examples/data/countries.geojson\"" ] }, { "cell_type": "markdown", "id": "9", "metadata": {}, "source": [ "Join data to the attribute table." ] }, { "cell_type": "code", "execution_count": null, "id": "10", "metadata": {}, "outputs": [], "source": [ "fc = geemap.ee_join_table(countries, data, src_key=\"id\", dst_key=\"ISO_A3\")" ] }, { "cell_type": "markdown", "id": "11", "metadata": {}, "source": [ "Display the new attribute table." ] }, { "cell_type": "code", "execution_count": null, "id": "12", "metadata": {}, "outputs": [], "source": [ "geemap.ee_to_df(fc)" ] }, { "cell_type": "markdown", "id": "13", "metadata": {}, "source": [ "Add the new data to the map." ] }, { "cell_type": "code", "execution_count": null, "id": "14", "metadata": {}, "outputs": [], "source": [ "Map.addLayer(fc, {}, \"Countries New\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }