From aaa70ccbeeb4180f1f42aea8963cd9cc628c8c97 Mon Sep 17 00:00:00 2001 From: Qiusheng Wu Date: Tue, 5 Apr 2022 10:04:00 -0400 Subject: [PATCH] Added binder --- README.md | 2 + binder/environment.yml | 6 ++ docs/index.ipynb | 5 +- examples/colab.ipynb | 57 +++++++++++ examples/examples.ipynb | 62 ++++++++++++ examples/leafmap.ipynb | 216 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 binder/environment.yml create mode 100644 examples/colab.ipynb create mode 100644 examples/examples.ipynb create mode 100644 examples/leafmap.ipynb diff --git a/README.md b/README.md index d3e450a..cd528d8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # geospatial +[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://gishub.org/geospatial-colab) +[![image](https://mybinder.org/badge_logo.svg)](https://gishub.org/geospatial-binder) [![image](https://img.shields.io/pypi/v/geospatial.svg)](https://pypi.python.org/pypi/geospatial) [![image](https://pepy.tech/badge/geospatial)](https://pepy.tech/project/geospatial) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/geospatial.svg)](https://anaconda.org/conda-forge/geospatial) diff --git a/binder/environment.yml b/binder/environment.yml new file mode 100644 index 0000000..4619545 --- /dev/null +++ b/binder/environment.yml @@ -0,0 +1,6 @@ +name: geo +channels: + - conda-forge +dependencies: + - geospatial + diff --git a/docs/index.ipynb b/docs/index.ipynb index 70e36fd..7be65e7 100644 --- a/docs/index.ipynb +++ b/docs/index.ipynb @@ -7,6 +7,9 @@ "source": [ "# Welcome to geospatial\n", "\n", + "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://gishub.org/geospatial-colab)\n", + "[![image](https://mybinder.org/badge_logo.svg)](https://gishub.org/geospatial-binder)\n", + "[![image](https://img.shields.io/pypi/v/geospatial.svg)](https://pypi.python.org/pypi/geospatial)\n", "[![image](https://img.shields.io/pypi/v/geospatial.svg)](https://pypi.python.org/pypi/geospatial)\n", "[![image](https://pepy.tech/badge/geospatial)](https://pepy.tech/project/geospatial)\n", "[![Conda Version](https://img.shields.io/conda/vn/conda-forge/geospatial.svg)](https://anaconda.org/conda-forge/geospatial)\n", @@ -729,7 +732,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, diff --git a/examples/colab.ipynb b/examples/colab.ipynb new file mode 100644 index 0000000..98d75e8 --- /dev/null +++ b/examples/colab.ipynb @@ -0,0 +1,57 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "213db57c-a9d6-498f-b33c-216daafafa6f", + "metadata": {}, + "outputs": [], + "source": [ + "!pip install geospatial" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dcb9503d-1b6f-4a7d-9ee2-c5a3e15664f0", + "metadata": {}, + "outputs": [], + "source": [ + "import leafmap" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2e120f6e-4cc1-481b-a1c9-36b574c55aec", + "metadata": {}, + "outputs": [], + "source": [ + "m = leafmap.Map()\n", + "m.add_basemap('OpenTopoMap')\n", + "m" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/examples/examples.ipynb b/examples/examples.ipynb new file mode 100644 index 0000000..5194e7d --- /dev/null +++ b/examples/examples.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "abef7881-70c4-401f-bafa-be17fbd36710", + "metadata": {}, + "outputs": [], + "source": [ + "import leafmap" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "31522b98-f361-4b8b-8e48-beced7cd0187", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2ac21d51f8274a6ebf8e217ab5ec5885", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "m = leafmap.Map()\n", + "m.add_basemap('OpenTopoMap')\n", + "m" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/examples/leafmap.ipynb b/examples/leafmap.ipynb new file mode 100644 index 0000000..66c1d6b --- /dev/null +++ b/examples/leafmap.ipynb @@ -0,0 +1,216 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "8fdcf68b", + "metadata": {}, + "source": [ + "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/giswqs/leafmap/blob/master/examples/notebooks/02_using_basemaps.ipynb)\n", + "[![image](https://mybinder.org/badge_logo.svg)](https://gishub.org/leafmap-binder)\n", + "\n", + "**Using basemaps in leafmap**\n", + "\n", + "Uncomment the following line to install [leafmap](https://leafmap.org) if needed." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6e8418cb", + "metadata": {}, + "outputs": [], + "source": [ + "import leafmap" + ] + }, + { + "cell_type": "markdown", + "id": "7803deb4", + "metadata": {}, + "source": [ + "Create an interactive map." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "795c2589", + "metadata": {}, + "outputs": [], + "source": [ + "m = leafmap.Map()\n", + "m" + ] + }, + { + "cell_type": "markdown", + "id": "6a6e718e", + "metadata": {}, + "source": [ + "Specify a Google basemap to use, can be one of [\"ROADMAP\", \"TERRAIN\", \"SATELLITE\", \"HYBRID\"]." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f3fb421e", + "metadata": {}, + "outputs": [], + "source": [ + "m = leafmap.Map(google_map=\"HYBRID\")\n", + "m" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "04972685", + "metadata": {}, + "outputs": [], + "source": [ + "m = leafmap.Map(google_map=\"TERRAIN\")\n", + "m" + ] + }, + { + "cell_type": "markdown", + "id": "18b5e064", + "metadata": {}, + "source": [ + "Add a basemap using the `add_basemap()` function." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6027a7cb", + "metadata": {}, + "outputs": [], + "source": [ + "m = leafmap.Map()\n", + "m.add_basemap(\"HYBRID\")\n", + "m.add_basemap(\"Esri.NatGeoWorldMap\")\n", + "m" + ] + }, + { + "cell_type": "markdown", + "id": "1f387ba1", + "metadata": {}, + "source": [ + "Add an XYZ tile layer." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6df7a1bf", + "metadata": {}, + "outputs": [], + "source": [ + "m = leafmap.Map()\n", + "m.add_tile_layer(\n", + " url=\"https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}\",\n", + " name=\"Google Satellite\",\n", + " attribution=\"Google\",\n", + ")\n", + "m" + ] + }, + { + "cell_type": "markdown", + "id": "6d1f1659", + "metadata": {}, + "source": [ + "Add a legend to the map." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ec54a702", + "metadata": {}, + "outputs": [], + "source": [ + "m = leafmap.Map(google_map=\"HYBRID\")\n", + "\n", + "url1 = \"https://www.fws.gov/wetlands/arcgis/services/Wetlands/MapServer/WMSServer?\"\n", + "m.add_wms_layer(\n", + " url1, layers=\"1\", format='image/png', transparent=True, name=\"NWI Wetlands Vector\"\n", + ")\n", + "\n", + "url2 = \"https://www.fws.gov/wetlands/arcgis/services/Wetlands_Raster/ImageServer/WMSServer?\"\n", + "m.add_wms_layer(\n", + " url2, layers=\"0\", format='image/png', transparent=True, name=\"NWI Wetlands Raster\"\n", + ")\n", + "\n", + "m.add_legend(builtin_legend=\"NWI\")\n", + "m" + ] + } + ], + "metadata": { + "hide_input": false, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": true, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false + }, + "varInspector": { + "cols": { + "lenName": 16, + "lenType": 16, + "lenVar": 40 + }, + "kernels_config": { + "python": { + "delete_cmd_postfix": "", + "delete_cmd_prefix": "del ", + "library": "var_list.py", + "varRefreshCmd": "print(var_dic_list())" + }, + "r": { + "delete_cmd_postfix": ") ", + "delete_cmd_prefix": "rm(", + "library": "var_list.r", + "varRefreshCmd": "cat(var_dic_list()) " + } + }, + "types_to_exclude": [ + "module", + "function", + "builtin_function_or_method", + "instance", + "_Feature" + ], + "window_display": false + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}