{ "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": [ "# %%capture\n", "# # optional\n", "# ! sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable\n", "# ! sudo apt-get update\n", "# ! sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev\n", "# ! sudo apt-get install libprotobuf-dev protobuf-compiler libv8-dev libjq-dev\n", "\n", "# # packages\n", "# ! pip install geopandas cartopy osmnx geemap" ] }, { "cell_type": "markdown", "id": "2", "metadata": {}, "source": [ "## Converting OpenStreetMap data to ee.FeatureCollection\n", "\n", "Credits to [Erik Seras](https://github.com/gee-community/geemap/discussions/503) for making this feature request and providing examples." ] }, { "cell_type": "code", "execution_count": null, "id": "3", "metadata": {}, "outputs": [], "source": [ "import geemap" ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "# geemap.update_package()" ] }, { "cell_type": "code", "execution_count": null, "id": "5", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "\n", "fc = geemap.osm_to_ee(\"Provincia de Lima, Lima, Perú\")\n", "Map.addLayer(fc, {}, \"Lima, Peru\")\n", "Map.centerObject(fc, 9)\n", "\n", "Map" ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": {}, "outputs": [], "source": [ "geemap.osm_to_geopandas(\"Provincia de Lima, Lima, Perú\")" ] }, { "cell_type": "code", "execution_count": null, "id": "7", "metadata": {}, "outputs": [], "source": [ "# geemap.osm_to_geojson(\"Provincia de Lima, Lima, Perú\")" ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "\n", "Map.add_osm(\"Provincia de Lima, Lima, Perú\", layer_name=\"Lima, Peru\")\n", "\n", "Map" ] }, { "cell_type": "code", "execution_count": null, "id": "9", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "\n", "Map.add_osm(\"Provincia de Lima, Lima, Perú\", layer_name=\"Lima, Peru\", to_ee=True)\n", "\n", "Map" ] }, { "cell_type": "code", "execution_count": null, "id": "10", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "\n", "Map.add_osm(\"('京都市, 日本国')\", layer_name=\"Kyoto, Japan\")\n", "\n", "Map" ] }, { "cell_type": "code", "execution_count": null, "id": "11", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "\n", "Map.add_osm(\"Knoxville, Tennessee\", layer_name=\"Knoxville, TN\")\n", "\n", "Map" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }