From 726cb15f5bda015ae4dd3b0d2365c2b8f3e8789a Mon Sep 17 00:00:00 2001 From: Qiusheng Wu Date: Wed, 14 Aug 2024 23:35:23 -0400 Subject: [PATCH] Add discord link (#870) * Add discord link * Remove overture example * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove overture example * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- README.md | 4 + docs/index.md | 4 + docs/maplibre/pmtiles.ipynb | 142 +++-------------------- docs/notebooks/82_pmtiles.ipynb | 121 ++----------------- docs/notebooks/93_maplibre_pmtiles.ipynb | 142 +++-------------------- 5 files changed, 52 insertions(+), 361 deletions(-) diff --git a/README.md b/README.md index 087ba36f4d..b2a03260b7 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,10 @@ - Leafmap tutorials on YouTube: - Free software: [MIT license](https://opensource.org/licenses/MIT) +Join our Discord server 👇 + +[![](https://dcbadge.limes.pink/api/server/https://discord.gg/UgZecTUq5P)](https://discord.gg/UgZecTUq5P) + ## Introduction **Leafmap** is a Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment. It is a spin-off project of the [geemap](https://geemap.org) Python package, which was designed specifically to work with [Google Earth Engine](https://earthengine.google.com) (GEE). However, not everyone in the geospatial community has access to the GEE cloud computing platform. Leafmap is designed to fill this gap for non-GEE users. It is a free and open-source Python package that enables users to analyze and visualize geospatial data with minimal coding in a Jupyter environment, such as Google Colab, Jupyter Notebook, and JupyterLab. Leafmap is built upon several open-source packages, such as [folium](https://github.com/python-visualization/folium) and [ipyleaflet](https://github.com/jupyter-widgets/ipyleaflet) (for creating interactive maps), [WhiteboxTools](https://github.com/jblindsay/whitebox-tools) and [whiteboxgui](https://github.com/opengeos/whiteboxgui) (for analyzing geospatial data), and [ipywidgets](https://github.com/jupyter-widgets/ipywidgets) (for designing interactive graphical user interface [GUI]). Leafmap has a toolset with various interactive tools that allow users to load vector and raster data onto the map without coding. In addition, users can use the powerful analytical backend (i.e., WhiteboxTools) to perform geospatial analysis directly within the leafmap user interface without writing a single line of code. The WhiteboxTools library currently contains **500+** tools for advanced geospatial analysis, such as [GIS Analysis](https://jblindsay.github.io/wbt_book/available_tools/gis_analysis.html), [Geomorphometric Analysis](https://jblindsay.github.io/wbt_book/available_tools/geomorphometric_analysis.html), [Hydrological Analysis](https://jblindsay.github.io/wbt_book/available_tools/hydrological_analysis.html), [LiDAR Data Analysis](https://jblindsay.github.io/wbt_book/available_tools/lidar_tools.html), [Mathematical and Statistical Analysis](https://jblindsay.github.io/wbt_book/available_tools/mathand_stats_tools.html), and [Stream Network Analysis](https://jblindsay.github.io/wbt_book/available_tools/stream_network_analysis.html). diff --git a/docs/index.md b/docs/index.md index 95bb1ed789..e20d027f08 100644 --- a/docs/index.md +++ b/docs/index.md @@ -26,6 +26,10 @@ - Leafmap tutorials on YouTube: - Free software: [MIT license](https://opensource.org/licenses/MIT) +Join our Discord server 👇 + +[![](https://dcbadge.limes.pink/api/server/https://discord.gg/UgZecTUq5P)](https://discord.gg/UgZecTUq5P) + ## Introduction **Leafmap** is a Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment. It is a spin-off project of the [geemap](https://geemap.org) Python package, which was designed specifically to work with [Google Earth Engine](https://earthengine.google.com) (GEE). However, not everyone in the geospatial community has access to the GEE cloud computing platform. Leafmap is designed to fill this gap for non-GEE users. It is a free and open-source Python package that enables users to analyze and visualize geospatial data with minimal coding in a Jupyter environment, such as Google Colab, Jupyter Notebook, and JupyterLab. Leafmap is built upon several open-source packages, such as [folium](https://github.com/python-visualization/folium) and [ipyleaflet](https://github.com/jupyter-widgets/ipyleaflet) (for creating interactive maps), [WhiteboxTools](https://github.com/jblindsay/whitebox-tools) and [whiteboxgui](https://github.com/opengeos/whiteboxgui) (for analyzing geospatial data), and [ipywidgets](https://github.com/jupyter-widgets/ipywidgets) (for designing interactive graphical user interfaces [GUIs]). Leafmap has a toolset with various interactive tools that allow users to load vector and raster data onto the map without coding. In addition, users can use the powerful analytical backend (i.e., WhiteboxTools) to perform geospatial analysis directly within the leafmap user interface without writing a single line of code. The WhiteboxTools library currently contains **500+** tools for advanced geospatial analysis, such as [GIS Analysis](https://jblindsay.github.io/wbt_book/available_tools/gis_analysis.html), [Geomorphometric Analysis](https://jblindsay.github.io/wbt_book/available_tools/geomorphometric_analysis.html), [Hydrological Analysis](https://jblindsay.github.io/wbt_book/available_tools/hydrological_analysis.html), [LiDAR Data Analysis](https://jblindsay.github.io/wbt_book/available_tools/lidar_tools.html), [Mathematical and Statistical Analysis](https://jblindsay.github.io/wbt_book/available_tools/mathand_stats_tools.html), and [Stream Network Analysis](https://jblindsay.github.io/wbt_book/available_tools/stream_network_analysis.html). diff --git a/docs/maplibre/pmtiles.ipynb b/docs/maplibre/pmtiles.ipynb index 5660910b50..6c896fac6e 100644 --- a/docs/maplibre/pmtiles.ipynb +++ b/docs/maplibre/pmtiles.ipynb @@ -129,116 +129,6 @@ "cell_type": "markdown", "id": "8", "metadata": {}, - "source": [ - "### Overture data" - ] - }, - { - "cell_type": "markdown", - "id": "9", - "metadata": {}, - "source": [ - "You can also visualize Overture data. Inspired by [overture-maps](https://github.com/tebben/overture-maps)." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "10", - "metadata": {}, - "outputs": [], - "source": [ - "url = \"https://storage.googleapis.com/ahp-research/overture/pmtiles/overture.pmtiles\"\n", - "metadata = leafmap.pmtiles_metadata(url)\n", - "print(f\"layer names: {metadata['layer_names']}\")\n", - "print(f\"bounds: {metadata['bounds']}\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "11", - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(height=\"800px\")\n", - "m.add_basemap(\"Esri.WorldImagery\")\n", - "\n", - "style = {\n", - " \"version\": 8,\n", - " \"sources\": {\n", - " \"example_source\": {\n", - " \"type\": \"vector\",\n", - " \"url\": \"pmtiles://\" + url,\n", - " \"attribution\": \"PMTiles\",\n", - " }\n", - " },\n", - " \"layers\": [\n", - " # {\n", - " # \"id\": \"admins\",\n", - " # \"source\": \"example_source\",\n", - " # \"source-layer\": \"admins\",\n", - " # \"type\": \"fill\",\n", - " # \"paint\": {\"fill-color\": \"#BDD3C7\", \"fill-opacity\": 0.1},\n", - " # },\n", - " {\n", - " \"id\": \"buildings\",\n", - " \"source\": \"example_source\",\n", - " \"source-layer\": \"buildings\",\n", - " \"type\": \"fill\",\n", - " \"paint\": {\"fill-color\": \"#FFFFB3\", \"fill-opacity\": 0.5},\n", - " },\n", - " {\n", - " \"id\": \"places\",\n", - " \"source\": \"example_source\",\n", - " \"source-layer\": \"places\",\n", - " \"type\": \"fill\",\n", - " \"paint\": {\"fill-color\": \"#BEBADA\", \"fill-opacity\": 0.5},\n", - " },\n", - " {\n", - " \"id\": \"roads\",\n", - " \"source\": \"example_source\",\n", - " \"source-layer\": \"roads\",\n", - " \"type\": \"line\",\n", - " \"paint\": {\"line-color\": \"#FB8072\"},\n", - " },\n", - " ],\n", - "}\n", - "\n", - "# style = leafmap.pmtiles_style(url) # Use default style\n", - "\n", - "m.add_pmtiles(\n", - " url,\n", - " style=style,\n", - " visible=True,\n", - " opacity=1.0,\n", - " tooltip=True,\n", - ")\n", - "m" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "12", - "metadata": {}, - "outputs": [], - "source": [ - "m.layer_interact()" - ] - }, - { - "cell_type": "markdown", - "id": "13", - "metadata": {}, - "source": [ - "![](https://i.imgur.com/ZOEbFGh.jpeg)" - ] - }, - { - "cell_type": "markdown", - "id": "14", - "metadata": {}, "source": [ "### Source Cooperative\n", "\n", @@ -248,7 +138,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15", + "id": "9", "metadata": {}, "outputs": [], "source": [ @@ -261,7 +151,7 @@ { "cell_type": "code", "execution_count": null, - "id": "16", + "id": "10", "metadata": {}, "outputs": [], "source": [ @@ -303,7 +193,7 @@ { "cell_type": "code", "execution_count": null, - "id": "17", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -312,7 +202,7 @@ }, { "cell_type": "markdown", - "id": "18", + "id": "12", "metadata": {}, "source": [ "![](https://i.imgur.com/rH0iLgc.png)" @@ -320,7 +210,7 @@ }, { "cell_type": "markdown", - "id": "19", + "id": "13", "metadata": {}, "source": [ "## Local PMTiles\n", @@ -333,7 +223,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -343,7 +233,7 @@ }, { "cell_type": "markdown", - "id": "21", + "id": "15", "metadata": {}, "source": [ "Convert vector to PMTiles." @@ -352,7 +242,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22", + "id": "16", "metadata": {}, "outputs": [], "source": [ @@ -364,7 +254,7 @@ }, { "cell_type": "markdown", - "id": "23", + "id": "17", "metadata": {}, "source": [ "Start a HTTP Sever" @@ -373,7 +263,7 @@ { "cell_type": "code", "execution_count": null, - "id": "24", + "id": "18", "metadata": {}, "outputs": [], "source": [ @@ -383,7 +273,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25", + "id": "19", "metadata": {}, "outputs": [], "source": [ @@ -393,7 +283,7 @@ }, { "cell_type": "markdown", - "id": "26", + "id": "20", "metadata": {}, "source": [ "Display the PMTiles on the map." @@ -402,7 +292,7 @@ { "cell_type": "code", "execution_count": null, - "id": "27", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -443,7 +333,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28", + "id": "22", "metadata": {}, "outputs": [], "source": [ @@ -452,7 +342,7 @@ }, { "cell_type": "markdown", - "id": "29", + "id": "23", "metadata": {}, "source": [ "![](https://i.imgur.com/PnYhph1.jpeg)" @@ -475,7 +365,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/notebooks/82_pmtiles.ipynb b/docs/notebooks/82_pmtiles.ipynb index 7d34610a4d..66598fd6e0 100644 --- a/docs/notebooks/82_pmtiles.ipynb +++ b/docs/notebooks/82_pmtiles.ipynb @@ -108,103 +108,6 @@ "cell_type": "markdown", "id": "6", "metadata": {}, - "source": [ - "### Overture data" - ] - }, - { - "cell_type": "markdown", - "id": "7", - "metadata": {}, - "source": [ - "You can also visualize Overture data. Inspired by [overture-maps](https://github.com/tebben/overture-maps)." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8", - "metadata": {}, - "outputs": [], - "source": [ - "url = \"https://storage.googleapis.com/ahp-research/overture/pmtiles/overture.pmtiles\"\n", - "metadata = leafmap.pmtiles_metadata(url)\n", - "print(f\"layer names: {metadata['layer_names']}\")\n", - "print(f\"bounds: {metadata['bounds']}\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9", - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(height=\"800px\")\n", - "m.add_basemap(\"CartoDB.DarkMatter\")\n", - "\n", - "style = {\n", - " \"version\": 8,\n", - " \"sources\": {\n", - " \"example_source\": {\n", - " \"type\": \"vector\",\n", - " \"url\": \"pmtiles://\" + url,\n", - " \"attribution\": \"PMTiles\",\n", - " }\n", - " },\n", - " \"layers\": [\n", - " {\n", - " \"id\": \"admins\",\n", - " \"source\": \"example_source\",\n", - " \"source-layer\": \"admins\",\n", - " \"type\": \"fill\",\n", - " \"paint\": {\"fill-color\": \"#BDD3C7\", \"fill-opacity\": 0.1},\n", - " },\n", - " {\n", - " \"id\": \"buildings\",\n", - " \"source\": \"example_source\",\n", - " \"source-layer\": \"buildings\",\n", - " \"type\": \"fill\",\n", - " \"paint\": {\"fill-color\": \"#FFFFB3\", \"fill-opacity\": 0.5},\n", - " },\n", - " {\n", - " \"id\": \"places\",\n", - " \"source\": \"example_source\",\n", - " \"source-layer\": \"places\",\n", - " \"type\": \"fill\",\n", - " \"paint\": {\"fill-color\": \"#BEBADA\", \"fill-opacity\": 0.5},\n", - " },\n", - " {\n", - " \"id\": \"roads\",\n", - " \"source\": \"example_source\",\n", - " \"source-layer\": \"roads\",\n", - " \"type\": \"line\",\n", - " \"paint\": {\"line-color\": \"#FB8072\"},\n", - " },\n", - " ],\n", - "}\n", - "\n", - "# style = leafmap.pmtiles_style(url) # Use default style\n", - "\n", - "m.add_pmtiles(\n", - " url, name=\"PMTiles\", style=style, overlay=True, show=True, zoom_to_layer=True\n", - ")\n", - "\n", - "legend_dict = {\n", - " \"admins\": \"BDD3C7\",\n", - " \"buildings\": \"FFFFB3\",\n", - " \"places\": \"BEBADA\",\n", - " \"roads\": \"FB8072\",\n", - "}\n", - "\n", - "m.add_legend(legend_dict=legend_dict)\n", - "m" - ] - }, - { - "cell_type": "markdown", - "id": "10", - "metadata": {}, "source": [ "### Source Cooperative\n", "\n", @@ -214,7 +117,7 @@ { "cell_type": "code", "execution_count": null, - "id": "11", + "id": "7", "metadata": {}, "outputs": [], "source": [ @@ -227,7 +130,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12", + "id": "8", "metadata": {}, "outputs": [], "source": [ @@ -270,7 +173,7 @@ { "cell_type": "code", "execution_count": null, - "id": "13", + "id": "9", "metadata": {}, "outputs": [], "source": [ @@ -279,7 +182,7 @@ }, { "cell_type": "markdown", - "id": "14", + "id": "10", "metadata": {}, "source": [ "## Local PMTiles\n", @@ -292,7 +195,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -302,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "16", + "id": "12", "metadata": {}, "source": [ "Convert vector to PMTiles." @@ -311,7 +214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "17", + "id": "13", "metadata": {}, "outputs": [], "source": [ @@ -323,7 +226,7 @@ }, { "cell_type": "markdown", - "id": "18", + "id": "14", "metadata": {}, "source": [ "Start a HTTP Sever" @@ -332,7 +235,7 @@ { "cell_type": "code", "execution_count": null, - "id": "19", + "id": "15", "metadata": {}, "outputs": [], "source": [ @@ -342,7 +245,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20", + "id": "16", "metadata": {}, "outputs": [], "source": [ @@ -352,7 +255,7 @@ }, { "cell_type": "markdown", - "id": "21", + "id": "17", "metadata": {}, "source": [ "Display the PMTiles on the map." @@ -361,7 +264,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22", + "id": "18", "metadata": {}, "outputs": [], "source": [ diff --git a/docs/notebooks/93_maplibre_pmtiles.ipynb b/docs/notebooks/93_maplibre_pmtiles.ipynb index 11616cbd18..2d6ea40d13 100644 --- a/docs/notebooks/93_maplibre_pmtiles.ipynb +++ b/docs/notebooks/93_maplibre_pmtiles.ipynb @@ -128,116 +128,6 @@ "cell_type": "markdown", "id": "8", "metadata": {}, - "source": [ - "### Overture data" - ] - }, - { - "cell_type": "markdown", - "id": "9", - "metadata": {}, - "source": [ - "You can also visualize Overture data. Inspired by [overture-maps](https://github.com/tebben/overture-maps)." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "10", - "metadata": {}, - "outputs": [], - "source": [ - "url = \"https://storage.googleapis.com/ahp-research/overture/pmtiles/overture.pmtiles\"\n", - "metadata = leafmap.pmtiles_metadata(url)\n", - "print(f\"layer names: {metadata['layer_names']}\")\n", - "print(f\"bounds: {metadata['bounds']}\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "11", - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(height=\"800px\")\n", - "m.add_basemap(\"Esri.WorldImagery\")\n", - "\n", - "style = {\n", - " \"version\": 8,\n", - " \"sources\": {\n", - " \"example_source\": {\n", - " \"type\": \"vector\",\n", - " \"url\": \"pmtiles://\" + url,\n", - " \"attribution\": \"PMTiles\",\n", - " }\n", - " },\n", - " \"layers\": [\n", - " # {\n", - " # \"id\": \"admins\",\n", - " # \"source\": \"example_source\",\n", - " # \"source-layer\": \"admins\",\n", - " # \"type\": \"fill\",\n", - " # \"paint\": {\"fill-color\": \"#BDD3C7\", \"fill-opacity\": 0.1},\n", - " # },\n", - " {\n", - " \"id\": \"buildings\",\n", - " \"source\": \"example_source\",\n", - " \"source-layer\": \"buildings\",\n", - " \"type\": \"fill\",\n", - " \"paint\": {\"fill-color\": \"#FFFFB3\", \"fill-opacity\": 0.5},\n", - " },\n", - " {\n", - " \"id\": \"places\",\n", - " \"source\": \"example_source\",\n", - " \"source-layer\": \"places\",\n", - " \"type\": \"fill\",\n", - " \"paint\": {\"fill-color\": \"#BEBADA\", \"fill-opacity\": 0.5},\n", - " },\n", - " {\n", - " \"id\": \"roads\",\n", - " \"source\": \"example_source\",\n", - " \"source-layer\": \"roads\",\n", - " \"type\": \"line\",\n", - " \"paint\": {\"line-color\": \"#FB8072\"},\n", - " },\n", - " ],\n", - "}\n", - "\n", - "# style = leafmap.pmtiles_style(url) # Use default style\n", - "\n", - "m.add_pmtiles(\n", - " url,\n", - " style=style,\n", - " visible=True,\n", - " opacity=1.0,\n", - " tooltip=True,\n", - ")\n", - "m" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "12", - "metadata": {}, - "outputs": [], - "source": [ - "m.layer_interact()" - ] - }, - { - "cell_type": "markdown", - "id": "13", - "metadata": {}, - "source": [ - "![](https://i.imgur.com/ZOEbFGh.jpeg)" - ] - }, - { - "cell_type": "markdown", - "id": "14", - "metadata": {}, "source": [ "### Source Cooperative\n", "\n", @@ -247,7 +137,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15", + "id": "9", "metadata": {}, "outputs": [], "source": [ @@ -260,7 +150,7 @@ { "cell_type": "code", "execution_count": null, - "id": "16", + "id": "10", "metadata": {}, "outputs": [], "source": [ @@ -302,7 +192,7 @@ { "cell_type": "code", "execution_count": null, - "id": "17", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -311,7 +201,7 @@ }, { "cell_type": "markdown", - "id": "18", + "id": "12", "metadata": {}, "source": [ "![](https://i.imgur.com/rH0iLgc.png)" @@ -319,7 +209,7 @@ }, { "cell_type": "markdown", - "id": "19", + "id": "13", "metadata": {}, "source": [ "## Local PMTiles\n", @@ -332,7 +222,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -342,7 +232,7 @@ }, { "cell_type": "markdown", - "id": "21", + "id": "15", "metadata": {}, "source": [ "Convert vector to PMTiles." @@ -351,7 +241,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22", + "id": "16", "metadata": {}, "outputs": [], "source": [ @@ -363,7 +253,7 @@ }, { "cell_type": "markdown", - "id": "23", + "id": "17", "metadata": {}, "source": [ "Start a HTTP Sever" @@ -372,7 +262,7 @@ { "cell_type": "code", "execution_count": null, - "id": "24", + "id": "18", "metadata": {}, "outputs": [], "source": [ @@ -382,7 +272,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25", + "id": "19", "metadata": {}, "outputs": [], "source": [ @@ -392,7 +282,7 @@ }, { "cell_type": "markdown", - "id": "26", + "id": "20", "metadata": {}, "source": [ "Display the PMTiles on the map." @@ -401,7 +291,7 @@ { "cell_type": "code", "execution_count": null, - "id": "27", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -442,7 +332,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28", + "id": "22", "metadata": {}, "outputs": [], "source": [ @@ -451,7 +341,7 @@ }, { "cell_type": "markdown", - "id": "29", + "id": "23", "metadata": {}, "source": [ "![](https://i.imgur.com/PnYhph1.jpeg)" @@ -474,7 +364,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4,