From a4c46a1a1f8b8c8275a72a5963761cba119de74a Mon Sep 17 00:00:00 2001 From: Qiusheng Wu Date: Thu, 4 Jul 2024 11:04:41 -0400 Subject: [PATCH] Update MapLibre notebook examples (#811) * Update MapLiber notebook examples * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix API key issue * Pin numpy version * Add YouTube video tutorials --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- docs/maplibre/3d_buildings.ipynb | 13 +-- docs/maplibre/3d_terrain.ipynb | 5 +- docs/maplibre/_template.ipynb | 18 +--- docs/maplibre/add_3d_buildings.ipynb | 6 +- docs/maplibre/add_colorbar.ipynb | 22 ++-- docs/maplibre/add_deckgl_layer.ipynb | 7 +- docs/maplibre/add_image.ipynb | 18 +--- docs/maplibre/add_image_generated.ipynb | 18 +--- docs/maplibre/add_text.ipynb | 32 ++---- docs/maplibre/animate_a_line.ipynb | 16 +-- .../animate_camera_around_point.ipynb | 16 +-- docs/maplibre/animate_images.ipynb | 18 +--- docs/maplibre/animate_point_along_line.ipynb | 16 +-- docs/maplibre/animate_point_along_route.ipynb | 16 +-- docs/maplibre/attribution_position.ipynb | 16 +-- docs/maplibre/basemaps.ipynb | 101 ++++++++++++++++++ docs/maplibre/center_on_symbol.ipynb | 16 +-- docs/maplibre/change_building_color.ipynb | 16 +-- docs/maplibre/change_case_of_labels.ipynb | 16 +-- docs/maplibre/cloud_optimized_geotiff.ipynb | 18 +--- docs/maplibre/cluster.ipynb | 16 +-- docs/maplibre/color_switcher.ipynb | 16 +-- docs/maplibre/custom_marker.ipynb | 16 +-- docs/maplibre/data_driven_lines.ipynb | 16 +-- docs/maplibre/disable_scroll_zoom.ipynb | 16 +-- docs/maplibre/display_rich_text.ipynb | 16 +-- docs/maplibre/drag_a_marker.ipynb | 16 +-- docs/maplibre/fallback_image.ipynb | 16 +-- docs/maplibre/fill_pattern.ipynb | 16 +-- docs/maplibre/fit_bounds.ipynb | 18 +--- docs/maplibre/fly_to.ipynb | 18 +--- docs/maplibre/fly_to_options.ipynb | 18 +--- docs/maplibre/fullscreen.ipynb | 18 +--- docs/maplibre/geojson_layer_in_stack.ipynb | 16 +-- docs/maplibre/geojson_line.ipynb | 18 +--- docs/maplibre/geojson_points.ipynb | 13 +-- docs/maplibre/geojson_polygon.ipynb | 18 +--- docs/maplibre/geopandas.ipynb | 16 +-- docs/maplibre/google_earth_engine.ipynb | 16 +-- docs/maplibre/heatmap_layer.ipynb | 16 +-- docs/maplibre/interactive_false.ipynb | 18 +--- docs/maplibre/jump_to.ipynb | 16 +-- docs/maplibre/language_switch.ipynb | 16 +-- docs/maplibre/layer_control.ipynb | 14 +-- docs/maplibre/line_gradient.ipynb | 16 +-- docs/maplibre/live_geojson.ipynb | 16 +-- docs/maplibre/live_update_feature.ipynb | 6 +- docs/maplibre/local_raster.ipynb | 18 +--- docs/maplibre/locate_user.ipynb | 16 +-- docs/maplibre/maptiler_styles.ipynb | 6 +- docs/maplibre/mouse_position.ipynb | 16 +-- docs/maplibre/multiple_geometries.ipynb | 16 +-- docs/maplibre/navigation.ipynb | 18 +--- docs/maplibre/overview.md | 12 +++ docs/maplibre/restrict_bounds.ipynb | 18 +--- docs/maplibre/satellite_map.ipynb | 18 +--- docs/maplibre/set_pitch_bearing.ipynb | 18 +--- docs/maplibre/stac.ipynb | 18 +--- docs/maplibre/variable_label_placement.ipynb | 18 +--- .../variable_offset_label_placement.ipynb | 18 +--- docs/maplibre/vector_tile.ipynb | 11 +- docs/maplibre/video_on_a_map.ipynb | 10 +- .../visualize_population_density.ipynb | 18 +--- docs/maplibre/wms_source.ipynb | 18 +--- docs/maplibre/zoom_to_linestring.ipynb | 18 +--- leafmap/maplibregl.py | 6 ++ mkdocs.yml | 7 +- requirements.txt | 2 +- 68 files changed, 350 insertions(+), 785 deletions(-) create mode 100644 docs/maplibre/basemaps.ipynb diff --git a/docs/maplibre/3d_buildings.ipynb b/docs/maplibre/3d_buildings.ipynb index cabcd27a6..6ee169d64 100644 --- a/docs/maplibre/3d_buildings.ipynb +++ b/docs/maplibre/3d_buildings.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,8 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/basic-v2/style.json?key={MAPTILER_KEY}\"" + "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")" ] }, { @@ -66,7 +65,9 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(center=[-74.0066, 40.7135], zoom=16, pitch=45, bearing=-17, style=style)\n", + "m = leafmap.Map(\n", + " center=[-74.0066, 40.7135], zoom=16, pitch=45, bearing=-17, style=\"basic-v2\"\n", + ")\n", "source = {\n", " \"url\": f\"https://api.maptiler.com/tiles/v3/tiles.json?key={MAPTILER_KEY}\",\n", " \"type\": \"vector\",\n", @@ -136,7 +137,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/3d_terrain.ipynb b/docs/maplibre/3d_terrain.ipynb index 99e81b52e..b197b1ce2 100644 --- a/docs/maplibre/3d_terrain.ipynb +++ b/docs/maplibre/3d_terrain.ipynb @@ -37,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -46,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -143,7 +144,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/_template.ipynb b/docs/maplibre/_template.ipynb index ac4311dda..f607a2728 100644 --- a/docs/maplibre/_template.ipynb +++ b/docs/maplibre/_template.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-100, 40], zoom=3, style=style)\n", + "m = leafmap.Map(center=[-100, 40], zoom=3, style=\"streets\")\n", "m" ] } @@ -87,7 +77,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.1.-1" } }, "nbformat": 4, diff --git a/docs/maplibre/add_3d_buildings.ipynb b/docs/maplibre/add_3d_buildings.ipynb index 0f7b3ee24..05ea04cee 100644 --- a/docs/maplibre/add_3d_buildings.ipynb +++ b/docs/maplibre/add_3d_buildings.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import time\n", "import leafmap.maplibregl as leafmap" ] @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,6 +47,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -116,7 +116,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/add_colorbar.ipynb b/docs/maplibre/add_colorbar.ipynb index 6c7591ab5..a3a8e3ffe 100644 --- a/docs/maplibre/add_colorbar.ipynb +++ b/docs/maplibre/add_colorbar.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,19 +46,10 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, { "cell_type": "code", "execution_count": null, @@ -75,7 +65,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(style=style)\n", + "m = leafmap.Map(style=\"streets\")\n", "m.add_cog_layer(\n", " dem, name=\"DEM\", colormap_name=\"terrain\", rescale=\"0, 4000\", fit_bounds=True\n", ")\n", @@ -98,7 +88,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(style=style)\n", + "m = leafmap.Map(style=\"streets\")\n", "m.add_cog_layer(\n", " dem, name=\"DEM\", colormap_name=\"terrain\", rescale=\"0, 4000\", fit_bounds=True\n", ")\n", @@ -126,7 +116,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(style=style)\n", + "m = leafmap.Map(style=\"streets\")\n", "m.add_cog_layer(\n", " dem, name=\"DEM\", colormap_name=\"terrain\", rescale=\"0, 4000\", fit_bounds=True\n", ")\n", @@ -167,7 +157,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/add_deckgl_layer.ipynb b/docs/maplibre/add_deckgl_layer.ipynb index 0c291b7f9..597ab9fe7 100644 --- a/docs/maplibre/add_deckgl_layer.ipynb +++ b/docs/maplibre/add_deckgl_layer.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -78,7 +77,7 @@ "source": [ "m = leafmap.Map(\n", " style=\"positron\",\n", - " center=(49.254, -123.13),\n", + " center=(-123.13, 49.254),\n", " zoom=11,\n", " pitch=45,\n", ")\n", @@ -135,7 +134,7 @@ "m = leafmap.Map(\n", " style=\"positron\",\n", " center=(51.47, 0.45),\n", - " zoom=4,\n", + " zoom=1,\n", " pitch=30,\n", ")\n", "deck_geojson_layer = {\n", @@ -201,7 +200,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/add_image.ipynb b/docs/maplibre/add_image.ipynb index d7d4fbcaf..95112a8e5 100644 --- a/docs/maplibre/add_image.ipynb +++ b/docs/maplibre/add_image.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[0.349419, -1.80921], zoom=3, style=style)\n", + "m = leafmap.Map(center=[0.349419, -1.80921], zoom=3, style=\"streets\")\n", "image = \"https://upload.wikimedia.org/wikipedia/commons/7/7c/201408_cat.png\"\n", "source = {\n", " \"type\": \"geojson\",\n", @@ -121,7 +111,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/add_image_generated.ipynb b/docs/maplibre/add_image_generated.ipynb index 94a8ede78..894f92d63 100644 --- a/docs/maplibre/add_image_generated.ipynb +++ b/docs/maplibre/add_image_generated.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import numpy as np\n", "import leafmap.maplibregl as leafmap" ] @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,19 +47,10 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, { "cell_type": "code", "execution_count": null, @@ -90,7 +80,7 @@ " \"data\": flat_data.tolist(),\n", "}\n", "\n", - "m = leafmap.Map(center=[0, 0], zoom=1, style=style)\n", + "m = leafmap.Map(center=[0, 0], zoom=1, style=\"streets\")\n", "m.add_image(\"gradient\", image_dict)\n", "source = {\n", " \"type\": \"geojson\",\n", @@ -138,7 +128,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/add_text.ipynb b/docs/maplibre/add_text.ipynb index d551a6e10..c43dc744e 100644 --- a/docs/maplibre/add_text.ipynb +++ b/docs/maplibre/add_text.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,31 +56,11 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-100, 40], zoom=3, style=style)\n", + "m = leafmap.Map(center=[-100, 40], zoom=3, style=\"streets\")\n", "text = \"Hello World\"\n", "m.add_text(text, fontsize=20, position=\"bottom-right\")\n", - "m" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-100, 40], zoom=3, style=style)\n", - "text = \"Awesome Text!\"\n", - "m.add_text(text, fontsize=25, bg_color=\"rgba(255, 255, 255, 0.8)\", position=\"top-left\")\n", + "text2 = \"Awesome Text!\"\n", + "m.add_text(text2, fontsize=25, bg_color=\"rgba(255, 255, 255, 0.8)\", position=\"top-left\")\n", "m" ] }, @@ -108,7 +88,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/animate_a_line.ipynb b/docs/maplibre/animate_a_line.ipynb index 95c7bd3c4..290bc8909 100644 --- a/docs/maplibre/animate_a_line.ipynb +++ b/docs/maplibre/animate_a_line.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import time\n", "import pandas as pd\n", "import leafmap.maplibregl as leafmap" @@ -40,7 +39,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -49,19 +48,10 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, { "cell_type": "code", "execution_count": null, @@ -81,7 +71,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(center=[0, 0], zoom=0.5, style=style)\n", + "m = leafmap.Map(center=[0, 0], zoom=0.5, style=\"streets\")\n", "geojson = {\n", " \"type\": \"FeatureCollection\",\n", " \"features\": [\n", diff --git a/docs/maplibre/animate_camera_around_point.ipynb b/docs/maplibre/animate_camera_around_point.ipynb index 74fd2f186..da7926ba2 100644 --- a/docs/maplibre/animate_camera_around_point.ipynb +++ b/docs/maplibre/animate_camera_around_point.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import time\n", "import leafmap.maplibregl as leafmap" ] @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,6 +47,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -57,17 +57,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-87.62712, 41.89033], zoom=15, pitch=45, style=style)\n", + "m = leafmap.Map(center=[-87.62712, 41.89033], zoom=15, pitch=45, style=\"streets\")\n", "layers = m.get_style_layers()\n", "for layer in layers:\n", " if layer[\"type\"] == \"symbol\" and (\"text-field\" in layer[\"layout\"]):\n", diff --git a/docs/maplibre/animate_images.ipynb b/docs/maplibre/animate_images.ipynb index 1f96b4752..5e2eb5231 100644 --- a/docs/maplibre/animate_images.ipynb +++ b/docs/maplibre/animate_images.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import time\n", "import leafmap.maplibregl as leafmap" ] @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,6 +47,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -57,17 +57,9 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-75.789, 41.874], zoom=5, min_zoom=4, max_zoom=6, style=style)\n", + "m = leafmap.Map(\n", + " center=[-75.789, 41.874], zoom=5, min_zoom=4, max_zoom=6, style=\"streets\"\n", + ")\n", "\n", "\n", "def get_path(index):\n", diff --git a/docs/maplibre/animate_point_along_line.ipynb b/docs/maplibre/animate_point_along_line.ipynb index 7372bd5d4..26e47d4c3 100644 --- a/docs/maplibre/animate_point_along_line.ipynb +++ b/docs/maplibre/animate_point_along_line.ipynb @@ -31,7 +31,6 @@ "outputs": [], "source": [ "import math\n", - "import os\n", "import time\n", "import leafmap.maplibregl as leafmap" ] @@ -40,7 +39,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -49,19 +48,10 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, { "cell_type": "code", "execution_count": null, @@ -81,7 +71,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(center=[0, 0], zoom=2, style=style)\n", + "m = leafmap.Map(center=[0, 0], zoom=2, style=\"streets\")\n", "radius = 20\n", "source = {\"type\": \"geojson\", \"data\": point_on_circle(0, radius)}\n", "m.add_source(\"point\", source)\n", diff --git a/docs/maplibre/animate_point_along_route.ipynb b/docs/maplibre/animate_point_along_route.ipynb index a48dfb266..a29b28fb7 100644 --- a/docs/maplibre/animate_point_along_route.ipynb +++ b/docs/maplibre/animate_point_along_route.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import time\n", "import requests\n", "import leafmap.maplibregl as leafmap" @@ -40,7 +39,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -49,6 +48,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -58,17 +58,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-100, 40], zoom=3, style=style)\n", + "m = leafmap.Map(center=[-100, 40], zoom=3, style=\"streets\")\n", "url = \"https://github.com/opengeos/datasets/releases/download/us/arc_with_bearings.geojson\"\n", "geojson = requests.get(url).json()\n", "bearings = geojson[\"features\"][0][\"properties\"][\"bearings\"]\n", diff --git a/docs/maplibre/attribution_position.ipynb b/docs/maplibre/attribution_position.ipynb index 29a15df42..8b64f057d 100644 --- a/docs/maplibre/attribution_position.ipynb +++ b/docs/maplibre/attribution_position.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-77.04, 38.907], zoom=11, style=style, controls={})\n", + "m = leafmap.Map(center=[-77.04, 38.907], zoom=11, style=\"streets\", controls={})\n", "m.add_control(\"attribution\", position=\"top-left\")\n", "m" ] diff --git a/docs/maplibre/basemaps.ipynb b/docs/maplibre/basemaps.ipynb new file mode 100644 index 000000000..7b409d05c --- /dev/null +++ b/docs/maplibre/basemaps.ipynb @@ -0,0 +1,101 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![image](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://demo.leafmap.org/lab/index.html?path=maplibre/basemaps.ipynb)\n", + "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/leafmap/blob/master/docs/maplibre/basemaps.ipynb)\n", + "[![image](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/opengeos/leafmap/HEAD)\n", + "\n", + "**Customize basemaps**\n", + "\n", + "Uncomment the following line to install [leafmap](https://leafmap.org) if needed." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# %pip install \"leafmap[maplibre]\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import leafmap.maplibregl as leafmap" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# import os\n", + "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "m = leafmap.Map(center=[-100, 40], zoom=3, style=\"streets\")\n", + "m" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "m = leafmap.Map(center=[-100, 40], zoom=3)\n", + "m.add_basemap(\"OpenTopoMap\")\n", + "m" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "![](https://i.imgur.com/inM3a7w.png)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/docs/maplibre/center_on_symbol.ipynb b/docs/maplibre/center_on_symbol.ipynb index 1be169a87..d16417231 100644 --- a/docs/maplibre/center_on_symbol.ipynb +++ b/docs/maplibre/center_on_symbol.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap\n", "import ipywidgets as widgets" ] @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,6 +47,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -57,17 +57,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-90.96, -0.47], zoom=7.5, style=style)\n", + "m = leafmap.Map(center=[-90.96, -0.47], zoom=7.5, style=\"streets\")\n", "image = \"https://maplibre.org/maplibre-gl-js/docs/assets/custom_marker.png\"\n", "m.add_image(\"custom-marker\", image)\n", "source = {\n", diff --git a/docs/maplibre/change_building_color.ipynb b/docs/maplibre/change_building_color.ipynb index 14d255b03..d518dd63c 100644 --- a/docs/maplibre/change_building_color.ipynb +++ b/docs/maplibre/change_building_color.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/basic/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-90.73414, 14.55524], zoom=13, style=style)\n", + "m = leafmap.Map(center=[-90.73414, 14.55524], zoom=13, style=\"basic\")\n", "m.set_paint_property(\n", " \"building\",\n", " \"fill-color\",\n", diff --git a/docs/maplibre/change_case_of_labels.ipynb b/docs/maplibre/change_case_of_labels.ipynb index 42c3ae401..1aecef1f0 100644 --- a/docs/maplibre/change_case_of_labels.ipynb +++ b/docs/maplibre/change_case_of_labels.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-116.231, 43.604], zoom=11, style=style)\n", + "m = leafmap.Map(center=[-116.231, 43.604], zoom=11, style=\"streets\")\n", "geojson = {\n", " \"type\": \"geojson\",\n", " \"data\": \"https://maplibre.org/maplibre-gl-js/docs/assets/boise.geojson\",\n", diff --git a/docs/maplibre/cloud_optimized_geotiff.ipynb b/docs/maplibre/cloud_optimized_geotiff.ipynb index e38eb1bfb..95e1c5de4 100644 --- a/docs/maplibre/cloud_optimized_geotiff.ipynb +++ b/docs/maplibre/cloud_optimized_geotiff.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/satellite/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(style=style)\n", + "m = leafmap.Map(style=\"satellite\")\n", "before = (\n", " \"https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-07-01.tif\"\n", ")\n", @@ -101,7 +91,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(style=style)\n", + "m = leafmap.Map(style=\"satellite\")\n", "dem = \"https://github.com/opengeos/datasets/releases/download/raster/srtm90.tif\"\n", "m.add_cog_layer(dem, name=\"DEM\", colormap_name=\"terrain\", fit_bounds=True)\n", "m" diff --git a/docs/maplibre/cluster.ipynb b/docs/maplibre/cluster.ipynb index 5bf8e9b05..dd30e8028 100644 --- a/docs/maplibre/cluster.ipynb +++ b/docs/maplibre/cluster.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-103.59179, 40.66995], zoom=3, style=style)\n", + "m = leafmap.Map(center=[-103.59179, 40.66995], zoom=3, style=\"streets\")\n", "data = \"https://docs.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson\"\n", "source_args = {\n", " \"cluster\": True,\n", diff --git a/docs/maplibre/color_switcher.ipynb b/docs/maplibre/color_switcher.ipynb index e2708af4c..26234be07 100644 --- a/docs/maplibre/color_switcher.ipynb +++ b/docs/maplibre/color_switcher.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[12.338, 45.4385], zoom=17, style=style)\n", + "m = leafmap.Map(center=[12.338, 45.4385], zoom=17, style=\"streets\")\n", "m" ] }, diff --git a/docs/maplibre/custom_marker.ipynb b/docs/maplibre/custom_marker.ipynb index ce0ae5eda..0e2465d4a 100644 --- a/docs/maplibre/custom_marker.ipynb +++ b/docs/maplibre/custom_marker.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import requests\n", "import leafmap.maplibregl as leafmap" ] @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,19 +47,10 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, { "cell_type": "code", "execution_count": null, @@ -79,7 +69,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(style=style)\n", + "m = leafmap.Map(style=\"streets\")\n", "source = {\"type\": \"geojson\", \"data\": geojson}\n", "\n", "layer = {\n", diff --git a/docs/maplibre/data_driven_lines.ipynb b/docs/maplibre/data_driven_lines.ipynb index 0a50dfc3e..33f9068d1 100644 --- a/docs/maplibre/data_driven_lines.ipynb +++ b/docs/maplibre/data_driven_lines.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-122.483831, 37.828826], zoom=16, style=style)\n", + "m = leafmap.Map(center=[-122.483831, 37.828826], zoom=16, style=\"streets\")\n", "geojson = {\n", " \"type\": \"FeatureCollection\",\n", " \"features\": [\n", diff --git a/docs/maplibre/disable_scroll_zoom.ipynb b/docs/maplibre/disable_scroll_zoom.ipynb index d19afaffe..52034cffe 100644 --- a/docs/maplibre/disable_scroll_zoom.ipynb +++ b/docs/maplibre/disable_scroll_zoom.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-122.65, 45.52], zoom=9, scroll_zoom=False, style=style)\n", + "m = leafmap.Map(center=[-122.65, 45.52], zoom=9, scroll_zoom=False, style=\"streets\")\n", "m" ] }, diff --git a/docs/maplibre/display_rich_text.ipynb b/docs/maplibre/display_rich_text.ipynb index 7d9fd8567..0fbf09178 100644 --- a/docs/maplibre/display_rich_text.ipynb +++ b/docs/maplibre/display_rich_text.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/basic/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[9.49, 49.01], zoom=4, style=style)\n", + "m = leafmap.Map(center=[9.49, 49.01], zoom=4, style=\"basic\")\n", "\n", "m.set_layout_property(\n", " \"label_country\",\n", diff --git a/docs/maplibre/drag_a_marker.ipynb b/docs/maplibre/drag_a_marker.ipynb index 1f1df816c..ce9c80043 100644 --- a/docs/maplibre/drag_a_marker.ipynb +++ b/docs/maplibre/drag_a_marker.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[0, 0], zoom=2, style=style)\n", + "m = leafmap.Map(center=[0, 0], zoom=2, style=\"streets\")\n", "m.add_marker(lng_lat=[0, 0], options={\"draggable\": True})\n", "m" ] diff --git a/docs/maplibre/fallback_image.ipynb b/docs/maplibre/fallback_image.ipynb index ce428bdeb..4174d2ed4 100644 --- a/docs/maplibre/fallback_image.ipynb +++ b/docs/maplibre/fallback_image.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-77, 38.75], zoom=5, style=style)\n", + "m = leafmap.Map(center=[-77, 38.75], zoom=5, style=\"streets\")\n", "source = {\n", " \"type\": \"geojson\",\n", " \"data\": {\n", diff --git a/docs/maplibre/fill_pattern.ipynb b/docs/maplibre/fill_pattern.ipynb index 5d00a1599..1076824c9 100644 --- a/docs/maplibre/fill_pattern.ipynb +++ b/docs/maplibre/fill_pattern.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(zoom=1, style=style)\n", + "m = leafmap.Map(zoom=1, style=\"streets\")\n", "source = {\n", " \"type\": \"geojson\",\n", " \"data\": {\n", diff --git a/docs/maplibre/fit_bounds.ipynb b/docs/maplibre/fit_bounds.ipynb index 35daf617a..63faf3647 100644 --- a/docs/maplibre/fit_bounds.ipynb +++ b/docs/maplibre/fit_bounds.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-74.5, 40], zoom=9, style=style)\n", + "m = leafmap.Map(center=[-74.5, 40], zoom=9, style=\"streets\")\n", "m" ] }, @@ -111,7 +101,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/fly_to.ipynb b/docs/maplibre/fly_to.ipynb index f26dd1b9e..3f85b26b8 100644 --- a/docs/maplibre/fly_to.ipynb +++ b/docs/maplibre/fly_to.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-2.242467, 53.478122], zoom=9, style=style)\n", + "m = leafmap.Map(center=[-2.242467, 53.478122], zoom=9, style=\"streets\")\n", "m" ] }, @@ -103,7 +93,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/fly_to_options.ipynb b/docs/maplibre/fly_to_options.ipynb index 3297589c7..f89444e26 100644 --- a/docs/maplibre/fly_to_options.ipynb +++ b/docs/maplibre/fly_to_options.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-74.5, 40], zoom=9, style=style)\n", + "m = leafmap.Map(center=[-74.5, 40], zoom=9, style=\"streets\")\n", "m" ] }, @@ -114,7 +104,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/fullscreen.ipynb b/docs/maplibre/fullscreen.ipynb index 6bec790f4..dcbaa1fe5 100644 --- a/docs/maplibre/fullscreen.ipynb +++ b/docs/maplibre/fullscreen.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[11.255, 43.77], zoom=13, style=style, controls={})\n", + "m = leafmap.Map(center=[11.255, 43.77], zoom=13, style=\"streets\", controls={})\n", "m.add_control(\"navigation\", position=\"top-left\")\n", "m.add_control(\"fullscreen\", position=\"top-right\")\n", "m" @@ -96,7 +86,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/geojson_layer_in_stack.ipynb b/docs/maplibre/geojson_layer_in_stack.ipynb index 7f97c055a..e19fc7c27 100644 --- a/docs/maplibre/geojson_layer_in_stack.ipynb +++ b/docs/maplibre/geojson_layer_in_stack.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-88.137343, 35.137451], zoom=4, style=style)\n", + "m = leafmap.Map(center=[-88.137343, 35.137451], zoom=4, style=\"streets\")\n", "source = {\n", " \"type\": \"geojson\",\n", " \"data\": \"https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_urban_areas.geojson\",\n", diff --git a/docs/maplibre/geojson_line.ipynb b/docs/maplibre/geojson_line.ipynb index b8561a6da..9cfb567c8 100644 --- a/docs/maplibre/geojson_line.ipynb +++ b/docs/maplibre/geojson_line.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-122.486052, 37.830348], zoom=15, style=style)\n", + "m = leafmap.Map(center=[-122.486052, 37.830348], zoom=15, style=\"streets\")\n", "\n", "source = {\n", " \"type\": \"geojson\",\n", @@ -138,7 +128,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/geojson_points.ipynb b/docs/maplibre/geojson_points.ipynb index efb7bc096..d1418e55b 100644 --- a/docs/maplibre/geojson_points.ipynb +++ b/docs/maplibre/geojson_points.ipynb @@ -32,7 +32,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -42,17 +41,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = os.environ.get(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/positron/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[0, 0], zoom=1, style=style)\n", + "m = leafmap.Map(center=[0, 0], zoom=1, style=\"positron\")\n", "image = \"https://maplibre.org/maplibre-gl-js/docs/assets/osgeo-logo.png\"\n", "m.add_image(\"custom-marker\", image)\n", "source = {\n", diff --git a/docs/maplibre/geojson_polygon.ipynb b/docs/maplibre/geojson_polygon.ipynb index 8fb4dd704..10e5e9436 100644 --- a/docs/maplibre/geojson_polygon.ipynb +++ b/docs/maplibre/geojson_polygon.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-68.137343, 45.137451], zoom=5, style=style)\n", + "m = leafmap.Map(center=[-68.137343, 45.137451], zoom=5, style=\"streets\")\n", "geojson = {\n", " \"type\": \"Feature\",\n", " \"geometry\": {\n", @@ -116,7 +106,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(center=[-68.137343, 45.137451], zoom=5, style=style)\n", + "m = leafmap.Map(center=[-68.137343, 45.137451], zoom=5, style=\"streets\")\n", "paint = {\"fill-color\": \"#088\", \"fill-opacity\": 0.8}\n", "m.add_geojson(geojson, layer_type=\"fill\", paint=paint)\n", "m" diff --git a/docs/maplibre/geopandas.ipynb b/docs/maplibre/geopandas.ipynb index 427cbd4ac..6a3d43095 100644 --- a/docs/maplibre/geopandas.ipynb +++ b/docs/maplibre/geopandas.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import geopandas as gpd\n", "import leafmap.maplibregl as leafmap" ] @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,6 +47,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -57,17 +57,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-100, 40], zoom=3, style=style)\n", + "m = leafmap.Map(center=[-100, 40], zoom=3, style=\"streets\")\n", "url = \"https://github.com/opengeos/datasets/releases/download/us/us_states.geojson\"\n", "gdf = gpd.read_file(url)\n", "paint = {\n", diff --git a/docs/maplibre/google_earth_engine.ipynb b/docs/maplibre/google_earth_engine.ipynb index 225bbe7f5..b166d6ef9 100644 --- a/docs/maplibre/google_earth_engine.ipynb +++ b/docs/maplibre/google_earth_engine.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,19 +46,10 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -117,7 +107,7 @@ "m.add_ee_layer(asset_id=\"ESA/WorldCover/v200\", opacity=0.5)\n", "m.add_legend(builtin_legend=\"ESA_WorldCover\", title=\"ESA Landcover\")\n", "m.add_layer_control()\n", - "\n", + "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", "source = {\n", " \"url\": f\"https://api.maptiler.com/tiles/v3/tiles.json?key={MAPTILER_KEY}\",\n", " \"type\": \"vector\",\n", diff --git a/docs/maplibre/heatmap_layer.ipynb b/docs/maplibre/heatmap_layer.ipynb index 6e994d30c..5044a0d74 100644 --- a/docs/maplibre/heatmap_layer.ipynb +++ b/docs/maplibre/heatmap_layer.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/basic/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-120, 50], zoom=2, style=style)\n", + "m = leafmap.Map(center=[-120, 50], zoom=2, style=\"basic\")\n", "source = {\n", " \"type\": \"geojson\",\n", " \"data\": \"https://maplibre.org/maplibre-gl-js/docs/assets/earthquakes.geojson\",\n", diff --git a/docs/maplibre/interactive_false.ipynb b/docs/maplibre/interactive_false.ipynb index 65c3f576b..12b07464f 100644 --- a/docs/maplibre/interactive_false.ipynb +++ b/docs/maplibre/interactive_false.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,9 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-74.5, 40], zoom=9, interactive=False, style=style, controls={})\n", + "m = leafmap.Map(\n", + " center=[-74.5, 40], zoom=9, interactive=False, style=\"streets\", controls={}\n", + ")\n", "m" ] }, diff --git a/docs/maplibre/jump_to.ipynb b/docs/maplibre/jump_to.ipynb index 8b61d69be..cf4176d50 100644 --- a/docs/maplibre/jump_to.ipynb +++ b/docs/maplibre/jump_to.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import time\n", "import leafmap.maplibregl as leafmap" ] @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,6 +47,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -57,17 +57,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[100.507, 13.745], zoom=9, style=style)\n", + "m = leafmap.Map(center=[100.507, 13.745], zoom=9, style=\"streets\")\n", "\n", "cities = {\n", " \"type\": \"FeatureCollection\",\n", diff --git a/docs/maplibre/language_switch.ipynb b/docs/maplibre/language_switch.ipynb index 78f21235d..d838c2bc5 100644 --- a/docs/maplibre/language_switch.ipynb +++ b/docs/maplibre/language_switch.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap\n", "import ipywidgets as widgets" ] @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,6 +47,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -57,17 +57,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/basic/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[16.05, 48], zoom=3, style=style)\n", + "m = leafmap.Map(center=[16.05, 48], zoom=3, style=\"basic\")\n", "languages = {\n", " \"English\": \"en\",\n", " \"French\": \"fr\",\n", diff --git a/docs/maplibre/layer_control.ipynb b/docs/maplibre/layer_control.ipynb index b04e07fa5..10aeff96d 100644 --- a/docs/maplibre/layer_control.ipynb +++ b/docs/maplibre/layer_control.ipynb @@ -28,7 +28,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -36,7 +35,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -45,19 +44,10 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, { "cell_type": "code", "execution_count": null, diff --git a/docs/maplibre/line_gradient.ipynb b/docs/maplibre/line_gradient.ipynb index 60f5d26dd..ee6e43120 100644 --- a/docs/maplibre/line_gradient.ipynb +++ b/docs/maplibre/line_gradient.ipynb @@ -32,7 +32,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -40,7 +39,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -49,6 +48,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -58,17 +58,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-77.035, 38.875], zoom=12, style=style)\n", + "m = leafmap.Map(center=[-77.035, 38.875], zoom=12, style=\"streets\")\n", "\n", "geojson = {\n", " \"type\": \"FeatureCollection\",\n", diff --git a/docs/maplibre/live_geojson.ipynb b/docs/maplibre/live_geojson.ipynb index be727304a..4d43d2316 100644 --- a/docs/maplibre/live_geojson.ipynb +++ b/docs/maplibre/live_geojson.ipynb @@ -32,7 +32,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import requests\n", "import time\n", "import leafmap.maplibregl as leafmap" @@ -42,7 +41,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -51,6 +50,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -60,17 +60,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[0, 20], zoom=1, style=style)\n", + "m = leafmap.Map(center=[0, 20], zoom=1, style=\"streets\")\n", "source = {\n", " \"type\": \"geojson\",\n", " \"data\": {\"type\": \"Feature\", \"geometry\": {\"type\": \"Point\", \"coordinates\": [0, 0]}},\n", diff --git a/docs/maplibre/live_update_feature.ipynb b/docs/maplibre/live_update_feature.ipynb index 29227507f..8d59ab7ae 100644 --- a/docs/maplibre/live_update_feature.ipynb +++ b/docs/maplibre/live_update_feature.ipynb @@ -32,7 +32,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import time\n", "import geopandas as gpd\n", "import leafmap.maplibregl as leafmap" @@ -42,7 +41,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -51,6 +50,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -138,7 +138,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/local_raster.ipynb b/docs/maplibre/local_raster.ipynb index b0f9aa9a3..90ba25784 100644 --- a/docs/maplibre/local_raster.ipynb +++ b/docs/maplibre/local_raster.ipynb @@ -31,7 +31,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,19 +47,10 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, { "cell_type": "code", "execution_count": null, @@ -78,7 +68,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(style=style)\n", + "m = leafmap.Map(style=\"streets\")\n", "m.add_raster(filepath, indexes=[3, 2, 1], vmin=0, vmax=100, name=\"Landsat-321\")\n", "m.add_raster(filepath, indexes=[4, 3, 2], vmin=0, vmax=100, name=\"Landsat-432\")\n", "m" @@ -117,7 +107,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(style=style)\n", + "m = leafmap.Map(style=\"streets\")\n", "m.add_raster(filepath, colormap=\"terrain\", name=\"DEM\")\n", "m" ] diff --git a/docs/maplibre/locate_user.ipynb b/docs/maplibre/locate_user.ipynb index 9b674ef11..c4fb1a425 100644 --- a/docs/maplibre/locate_user.ipynb +++ b/docs/maplibre/locate_user.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-96, 37.8], zoom=3, style=style, controls={})\n", + "m = leafmap.Map(center=[-96, 37.8], zoom=3, style=\"streets\", controls={})\n", "m.add_control(\"geolocate\", position=\"top-right\")\n", "m" ] diff --git a/docs/maplibre/maptiler_styles.ipynb b/docs/maplibre/maptiler_styles.ipynb index 4069e4ced..21d4a1673 100644 --- a/docs/maplibre/maptiler_styles.ipynb +++ b/docs/maplibre/maptiler_styles.ipynb @@ -31,7 +31,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,6 +47,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -119,7 +119,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/mouse_position.ipynb b/docs/maplibre/mouse_position.ipynb index c5ba26ce4..2528e8490 100644 --- a/docs/maplibre/mouse_position.ipynb +++ b/docs/maplibre/mouse_position.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import ipywidgets as widgets\n", "import leafmap.maplibregl as leafmap" ] @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,6 +47,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -57,17 +57,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-74.5, 40], zoom=9, style=style)\n", + "m = leafmap.Map(center=[-74.5, 40], zoom=9, style=\"streets\")\n", "m" ] }, diff --git a/docs/maplibre/multiple_geometries.ipynb b/docs/maplibre/multiple_geometries.ipynb index 880866088..3c26ecf36 100644 --- a/docs/maplibre/multiple_geometries.ipynb +++ b/docs/maplibre/multiple_geometries.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-121.403732, 40.492392], zoom=10, style=style)\n", + "m = leafmap.Map(center=[-121.403732, 40.492392], zoom=10, style=\"streets\")\n", "source = {\n", " \"type\": \"geojson\",\n", " \"data\": {\n", diff --git a/docs/maplibre/navigation.ipynb b/docs/maplibre/navigation.ipynb index 87a87ca9e..71c1ad9ba 100644 --- a/docs/maplibre/navigation.ipynb +++ b/docs/maplibre/navigation.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-74.5, 40], zoom=9, style=style, controls={})\n", + "m = leafmap.Map(center=[-74.5, 40], zoom=9, style=\"streets\", controls={})\n", "m.add_control(\"navigation\", position=\"top-right\")\n", "m" ] @@ -95,7 +85,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/overview.md b/docs/maplibre/overview.md index 2776cb6a4..09acd4409 100644 --- a/docs/maplibre/overview.md +++ b/docs/maplibre/overview.md @@ -4,6 +4,12 @@ This page contains examples of using [MapLibre](https://maplibre.org) with Leafm To preview the examples, visit . +## Video tutorials on YouTube + +Video tutorials on how to use Leafmap with MapLibre are available on YouTube: + +[![](https://i.imgur.com/dsxACGG.png)](https://bit.ly/maplibre) + ## Display buildings in 3D Use extrusions to display buildings' height in 3D. @@ -130,6 +136,12 @@ Place attribution in the top-left position when initializing a map. [![](https://i.imgur.com/DsmqIOy.png)](https://leafmap.org/maplibre/attribution_position) +## Customize basemaps + +Customize basemaps with MapTiler and xyzservices. + +[![](https://i.imgur.com/inM3a7w.png)](https://leafmap.org/maplibre/basemaps) + ## Center the map on a clicked symbol Use events and flyTo to center the map on a symbol. diff --git a/docs/maplibre/restrict_bounds.ipynb b/docs/maplibre/restrict_bounds.ipynb index 735cee472..7ab04254c 100644 --- a/docs/maplibre/restrict_bounds.ipynb +++ b/docs/maplibre/restrict_bounds.ipynb @@ -31,7 +31,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,19 +47,10 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, { "cell_type": "code", "execution_count": null, @@ -79,7 +69,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(center=[-73.9978, 40.7209], zoom=13, max_bounds=bounds, style=style)\n", + "m = leafmap.Map(center=[-73.9978, 40.7209], zoom=13, max_bounds=bounds, style=\"streets\")\n", "m" ] }, @@ -107,7 +97,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/satellite_map.ipynb b/docs/maplibre/satellite_map.ipynb index 3bb1684ae..0e43172d5 100644 --- a/docs/maplibre/satellite_map.ipynb +++ b/docs/maplibre/satellite_map.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/hybrid/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[137.9150899566626, 36.25956997955441], zoom=9, style=style)\n", + "m = leafmap.Map(center=[137.9150899566626, 36.25956997955441], zoom=9, style=\"hybrid\")\n", "m" ] }, @@ -121,7 +111,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/set_pitch_bearing.ipynb b/docs/maplibre/set_pitch_bearing.ipynb index d8db6d919..40bd859ff 100644 --- a/docs/maplibre/set_pitch_bearing.ipynb +++ b/docs/maplibre/set_pitch_bearing.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,19 +46,10 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, { "cell_type": "code", "execution_count": null, @@ -67,7 +57,7 @@ "outputs": [], "source": [ "m = leafmap.Map(\n", - " center=[-73.5804, 45.53483], zoom=10, pitch=60, bearing=-60, style=style\n", + " center=[-73.5804, 45.53483], zoom=10, pitch=60, bearing=-60, style=\"streets\"\n", ")\n", "m" ] @@ -96,7 +86,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/stac.ipynb b/docs/maplibre/stac.ipynb index 8dd6b405d..79831dcc6 100644 --- a/docs/maplibre/stac.ipynb +++ b/docs/maplibre/stac.ipynb @@ -31,7 +31,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -39,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -48,6 +47,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -57,17 +57,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(style=style)\n", + "m = leafmap.Map(style=\"streets\")\n", "url = \"https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json\"\n", "m.add_stac_layer(url, bands=[\"pan\"], name=\"Panchromatic\", vmin=0, vmax=150)\n", "m.add_stac_layer(url, bands=[\"B4\", \"B3\", \"B2\"], name=\"RGB\", vmin=0, vmax=150)\n", @@ -115,7 +105,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(style=style)\n", + "m = leafmap.Map(style=\"streets\")\n", "m.add_stac_layer(\n", " collection=collection,\n", " item=item,\n", diff --git a/docs/maplibre/variable_label_placement.ipynb b/docs/maplibre/variable_label_placement.ipynb index e1d6844bb..bdc5d7982 100644 --- a/docs/maplibre/variable_label_placement.ipynb +++ b/docs/maplibre/variable_label_placement.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-77.04, 38.907], zoom=11, style=style)\n", + "m = leafmap.Map(center=[-77.04, 38.907], zoom=11, style=\"streets\")\n", "\n", "places = {\n", " \"type\": \"FeatureCollection\",\n", @@ -161,7 +151,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/variable_offset_label_placement.ipynb b/docs/maplibre/variable_offset_label_placement.ipynb index 2e5f52426..e53354d79 100644 --- a/docs/maplibre/variable_offset_label_placement.ipynb +++ b/docs/maplibre/variable_offset_label_placement.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-77.04, 38.907], zoom=11, style=style)\n", + "m = leafmap.Map(center=[-77.04, 38.907], zoom=11, style=\"streets\")\n", "\n", "places = {\n", " \"type\": \"FeatureCollection\",\n", @@ -169,7 +159,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/vector_tile.ipynb b/docs/maplibre/vector_tile.ipynb index f3fddce9b..461ccaece 100644 --- a/docs/maplibre/vector_tile.ipynb +++ b/docs/maplibre/vector_tile.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,8 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" + "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")" ] }, { @@ -66,7 +65,7 @@ "metadata": {}, "outputs": [], "source": [ - "m = leafmap.Map(center=[-122.447303, 37.753574], zoom=13, style=style)\n", + "m = leafmap.Map(center=[-122.447303, 37.753574], zoom=13, style=\"streets\")\n", "source = {\n", " \"type\": \"vector\",\n", " \"url\": f\"https://api.maptiler.com/tiles/contours/tiles.json?key={MAPTILER_KEY}\",\n", @@ -108,7 +107,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/video_on_a_map.ipynb b/docs/maplibre/video_on_a_map.ipynb index 884d2667a..fb726204e 100644 --- a/docs/maplibre/video_on_a_map.ipynb +++ b/docs/maplibre/video_on_a_map.ipynb @@ -4,8 +4,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "[![image](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://demo.leafmap.org/lab/index.html?path=maplibre/add_video.ipynb)\n", - "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/leafmap/blob/master/docs/maplibre/add_video.ipynb)\n", + "[![image](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://demo.leafmap.org/lab/index.html?path=maplibre/video_on_a_map.ipynb)\n", + "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/leafmap/blob/master/docs/maplibre/video_on_a_map.ipynb)\n", "[![image](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/opengeos/leafmap/HEAD)\n", "\n", "**Add a video**\n", @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -133,7 +133,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/visualize_population_density.ipynb b/docs/maplibre/visualize_population_density.ipynb index e502680dd..d1cbfaaaa 100644 --- a/docs/maplibre/visualize_population_density.ipynb +++ b/docs/maplibre/visualize_population_density.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[30.0222, -1.9596], zoom=7, style=style)\n", + "m = leafmap.Map(center=[30.0222, -1.9596], zoom=7, style=\"streets\")\n", "source = {\n", " \"type\": \"geojson\",\n", " \"data\": \"https://maplibre.org/maplibre-gl-js/docs/assets/rwanda-provinces.geojson\",\n", @@ -139,7 +129,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/wms_source.ipynb b/docs/maplibre/wms_source.ipynb index bdf7956f4..23796994b 100644 --- a/docs/maplibre/wms_source.ipynb +++ b/docs/maplibre/wms_source.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-74.5447, 40.6892], zoom=8, style=style)\n", + "m = leafmap.Map(center=[-74.5447, 40.6892], zoom=8, style=\"streets\")\n", "\n", "source = {\n", " \"type\": \"raster\",\n", @@ -110,7 +100,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/docs/maplibre/zoom_to_linestring.ipynb b/docs/maplibre/zoom_to_linestring.ipynb index 932c94ecf..43ac09381 100644 --- a/docs/maplibre/zoom_to_linestring.ipynb +++ b/docs/maplibre/zoom_to_linestring.ipynb @@ -30,7 +30,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import leafmap.maplibregl as leafmap" ] }, @@ -38,7 +37,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can set it as an environment variable in your notebook or script as follows:" + "To run this notebook, you will need an [API key](https://docs.maptiler.com/cloud/api/authentication-key/) from [MapTiler](https://www.maptiler.com/cloud/). Once you have the API key, you can uncomment the following code block and replace `YOUR_API_KEY` with your actual API key. Then, run the code block code to set the API key as an environment variable." ] }, { @@ -47,6 +46,7 @@ "metadata": {}, "outputs": [], "source": [ + "# import os\n", "# os.environ[\"MAPTILER_KEY\"] = \"YOUR_API_KEY\"" ] }, @@ -56,17 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "MAPTILER_KEY = leafmap.get_api_key(\"MAPTILER_KEY\")\n", - "style = f\"https://api.maptiler.com/maps/streets/style.json?key={MAPTILER_KEY}\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "m = leafmap.Map(center=[-77.0214, 38.897], zoom=12, style=style)\n", + "m = leafmap.Map(center=[-77.0214, 38.897], zoom=12, style=\"streets\")\n", "\n", "geojson = {\n", " \"type\": \"FeatureCollection\",\n", @@ -149,7 +139,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.9" } }, "nbformat": 4, diff --git a/leafmap/maplibregl.py b/leafmap/maplibregl.py index 2cbdd212f..f90d233e7 100644 --- a/leafmap/maplibregl.py +++ b/leafmap/maplibregl.py @@ -89,6 +89,9 @@ def __init__( if style.startswith("https"): response = requests.get(style) if response.status_code != 200: + print( + "The provided style URL is invalid. Falling back to 'dark-matter'." + ) style = "dark-matter" elif style == "3d-terrain": style = self._get_3d_terrain_style( @@ -2823,6 +2826,9 @@ def construct_maptiler_style(style: str, api_key: Optional[str] = None) -> str: response = requests.get(url) if response.status_code != 200: + print( + "Failed to retrieve the MapTiler style. Defaulting to 'dark-matter' style." + ) url = "dark-matter" return url diff --git a/mkdocs.yml b/mkdocs.yml index 6cb11bf82..a7f7d3d37 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -51,7 +51,10 @@ plugins: execute: True allow_errors: false ignore: ["conf.py", "data/README.md", "usage.md"] - execute_ignore: [ + execute_ignore: + [ + "check_maplibre.py", + "changelog_update.py", "workshops/*.ipynb", "notebooks/02_using_basemaps.ipynb", "notebooks/08_whitebox.ipynb", @@ -62,7 +65,6 @@ plugins: "notebooks/40_plotly_gui.ipynb", "notebooks/42_create_cog.ipynb", "notebooks/50_marker_cluster.ipynb", - # "notebooks/52_netcdf.ipynb", "notebooks/57_national_map.ipynb", "notebooks/67_maxar_open_data.ipynb", "notebooks/69_turkey_earthquake.ipynb", @@ -159,6 +161,7 @@ nav: - maplibre/animate_point_along_line.ipynb - maplibre/animate_point_along_route.ipynb - maplibre/attribution_position.ipynb + - maplibre/basemaps.ipynb - maplibre/center_on_symbol.ipynb - maplibre/change_building_color.ipynb - maplibre/change_case_of_labels.ipynb diff --git a/requirements.txt b/requirements.txt index 881fb3658..9684375e0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ ipyleaflet ipyvuetify ipywidgets matplotlib -numpy +numpy<2.0.0 pandas plotly pyshp