{ "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 os\n", "import geemap" ] }, { "cell_type": "code", "execution_count": null, "id": "3", "metadata": {}, "outputs": [], "source": [ "# geemap.update_package()" ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "Map" ] }, { "cell_type": "code", "execution_count": null, "id": "5", "metadata": {}, "outputs": [], "source": [ "in_csv = \"https://raw.githubusercontent.com/giswqs/data/main/world/world_cities.csv\"" ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": {}, "outputs": [], "source": [ "df = geemap.csv_to_df(in_csv)\n", "df" ] }, { "cell_type": "code", "execution_count": null, "id": "7", "metadata": {}, "outputs": [], "source": [ "Map.add_xy_data(in_csv, x=\"longitude\", y=\"latitude\", layer_name=\"csv to ee\", to_ee=True)" ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": {}, "outputs": [], "source": [ "fc = geemap.csv_to_ee(in_csv)" ] }, { "cell_type": "code", "execution_count": null, "id": "9", "metadata": {}, "outputs": [], "source": [ "Map.addLayer(fc, {}, \"csv to ee 2\")" ] }, { "cell_type": "code", "execution_count": null, "id": "10", "metadata": {}, "outputs": [], "source": [ "out_dir = os.path.expanduser(\"~/Downloads\")\n", "if not os.path.exists(out_dir):\n", " os.makedirs(out_dir)\n", "out_shp = os.path.join(out_dir, \"world_cities.shp\")" ] }, { "cell_type": "code", "execution_count": null, "id": "11", "metadata": {}, "outputs": [], "source": [ "geemap.csv_to_shp(in_csv, out_shp)" ] }, { "cell_type": "code", "execution_count": null, "id": "12", "metadata": {}, "outputs": [], "source": [ "out_geojson = os.path.join(out_dir, \"world_cities.geojson\")\n", "geemap.csv_to_geojson(in_csv, out_geojson)" ] }, { "cell_type": "code", "execution_count": null, "id": "13", "metadata": {}, "outputs": [], "source": [ "gdf = geemap.csv_to_gdf(in_csv)\n", "gdf" ] }, { "cell_type": "code", "execution_count": null, "id": "14", "metadata": {}, "outputs": [], "source": [ "Map.add_xy_data(in_csv, x=\"longitude\", y=\"latitude\", layer_name=\"Marker cluster\")\n", "Map" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }