Skip to content

Commit

Permalink
Add support for OSM vector tiles (#985)
Browse files Browse the repository at this point in the history
* Add support for OSM vector tiles

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
giswqs and pre-commit-ci[bot] authored Nov 18, 2024
1 parent 476a60d commit 22d239e
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docs/maplibre/add_icon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,20 @@
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"![image](https://github.com/user-attachments/assets/b4082d29-b604-4f52-a7e7-88d15d37c7fc)"
"m = leafmap.Map(style=\"3d-terrain\")\n",
"url = \"https://github.com/opengeos/datasets/releases/download/vector/hike_gps_trace_line.geojson\"\n",
"m.add_geojson(url, name=\"Hiking Trail\")\n",
"m.add_layer_control()\n",
"image = \"https://i.imgur.com/ZMMvXuT.png\"\n",
"m.add_symbol(\n",
" image, source=\"Hiking Trail\", icon_size=0.1, symbol_placement=\"line\", minzoom=10\n",
")\n",
"m"
]
}
],
Expand Down
84 changes: 84 additions & 0 deletions docs/maplibre/openstreetmap.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"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/openstreetmap.ipynb)\n",
"[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/leafmap/blob/master/docs/maplibre/openstreetmap.ipynb)\n",
"[![image](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/opengeos/leafmap/HEAD)\n",
"\n",
"**Use OpenStreetMap vector tiles**\n",
"\n",
"The [openstreetmap.json](https://maps.gishub.org/styles/openstreetmap.json) is adapted from the [colorful.json](https://pnorman.github.io/tilekiln-shortbread-demo/colorful.json) created by Paul Norman. For more information about the OpenStreetMap vector tiles, see this [thread](https://community.openstreetmap.org/t/vector-tiles-on-osmf-hardware/121501).\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": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"style = \"https://maps.gishub.org/styles/openstreetmap.json\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"m = leafmap.Map(style=style)\n",
"m"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![image](https://github.com/user-attachments/assets/af350646-d668-4eeb-a611-8ca270631d2d)"
]
}
],
"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
}
6 changes: 6 additions & 0 deletions docs/maplibre/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,12 @@ Use free vector tiles from OpenFreeMap.

[![](https://github.com/user-attachments/assets/0a9c8cb8-2b7e-4ca5-ba7b-183b8b3f54a6)](https://leafmap.org/maplibre/openfreemap)

## Use OpenStreetMap vector tiles

Use free vector tiles from OpenStreetMap.

[![](https://github.com/user-attachments/assets/af350646-d668-4eeb-a611-8ca270631d2d)](https://leafmap.org/maplibre/openstreetmap)

## Visualze Overture data

Visualize Overture Maps data.
Expand Down

0 comments on commit 22d239e

Please sign in to comment.