{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/gee-community/geemap/blob/master/examples/notebooks/106_kepler_gl.ipynb)\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 -U geemap" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import geemap.kepler as geemap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create an interactive map. You can specify various parameters to initialize the map, such as `center`, `zoom`, `height`, and `widescreen`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m = geemap.Map(center=[40, -100], zoom=2, height=600, widescreen=False)\n", "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Save the map to an interactive html. To hide the side panel and disable map customization. Set `read_only=False`" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m.to_html(filename=\"kepler.html\", read_only=False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Display the interactive map in a notebook cell." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# m.static_map(width=950, height=600, read_only=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Add a GeoJSON to the map." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m = geemap.Map(center=[20, 0], zoom=1)\n", "lines = 'https://raw.githubusercontent.com/giswqs/leafmap/master/examples/data/cable_geo.geojson'\n", "m.add_geojson(lines, layer_name=\"Cable lines\")\n", "m" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m.to_html(\"kepler_lines.html\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Add a GeoJSON with US state boundaries to the map." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m = geemap.Map(center=[50, -110], zoom=2)\n", "polygons = 'https://raw.githubusercontent.com/giswqs/leafmap/master/examples/data/us_states.json'\n", "m.add_geojson(polygons, layer_name=\"Countries\")\n", "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Add a shapefile to the map." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m = geemap.Map(center=[20, 0], zoom=1)\n", "in_shp = \"https://github.com/gee-community/geemap/raw/master/examples/data/countries.zip\"\n", "m.add_shp(in_shp, \"Countries\")\n", "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Add a GeoPandas GeoDataFrame to the map." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import geopandas as gpd" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "gdf = gpd.read_file(\n", " \"https://raw.githubusercontent.com/giswqs/leafmap/master/examples/data/world_cities.geojson\"\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "gdf" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m = geemap.Map(center=[20, 0], zoom=1)\n", "m.add_gdf(gdf, \"World cities\")\n", "m" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }