mirror of
https://github.com/apache/superset.git
synced 2026-07-25 16:12:39 +00:00
108 lines
3.0 KiB
Plaintext
108 lines
3.0 KiB
Plaintext
---
|
|
title: Map Tiles
|
|
sidebar_position: 12
|
|
version: 1
|
|
---
|
|
|
|
# Map tiles
|
|
|
|
Superset uses OSM and Mapbox tiles by default. OSM is free but you still need setting your MAPBOX_API_KEY if you want to use mapbox maps.
|
|
|
|
## Setting map tiles
|
|
|
|
Map tiles can be set with `DECKGL_BASE_MAP` in your `superset_config.py` or `superset_config_docker.py`
|
|
For adding your own map tiles, you can use the following format.
|
|
|
|
```python
|
|
DECKGL_BASE_MAP = [
|
|
['tile://https://your_personal_url/{z}/{x}/{y}.png', 'MyTile']
|
|
]
|
|
```
|
|
Openstreetmap tiles url can be added without prefix.
|
|
```python
|
|
DECKGL_BASE_MAP = [
|
|
['https://c.tile.openstreetmap.org/{z}/{x}/{y}.png', 'OpenStreetMap']
|
|
]
|
|
```
|
|
|
|
[Yandex Tiles API](https://yandex.ru/maps-api/docs/tiles-api/request.html) can be used as a custom tile provider. The URL must include the `apikey` from the [Yandex Developer Dashboard](https://developer.tech.yandex.ru/services), tile coordinates (`x`, `y`, and `z`), and the required map layer parameters.
|
|
|
|
```python
|
|
DECKGL_BASE_MAP = [
|
|
[
|
|
"tile://https://tiles.api-maps.yandex.ru/v1/tiles/"
|
|
"?apikey=YOUR_YANDEX_API_KEY"
|
|
"&lang=ru_RU"
|
|
"&x={x}&y={y}&z={z}"
|
|
"&l=map"
|
|
"&projection=web_mercator"
|
|
"&maptype=map",
|
|
"Yandex Maps - Web Mercator",
|
|
],
|
|
[
|
|
"tile://https://tiles.api-maps.yandex.ru/v1/tiles/"
|
|
"?apikey=YOUR_YANDEX_API_KEY"
|
|
"&lang=ru_RU"
|
|
"&x={x}&y={y}&z={z}"
|
|
"&l=map"
|
|
"&projection=wgs84_mercator"
|
|
"&maptype=map",
|
|
"Yandex Maps - WGS84 Mercator",
|
|
],
|
|
]
|
|
```
|
|
|
|
Default values are:
|
|
```python
|
|
DECKGL_BASE_MAP = [
|
|
['https://tile.openstreetmap.org/{z}/{x}/{y}.png', 'Streets (OSM)'],
|
|
['https://tile.osm.ch/osm-swiss-style/{z}/{x}/{y}.png', 'Topography (OSM)'],
|
|
['mapbox://styles/mapbox/streets-v9', 'Streets'],
|
|
['mapbox://styles/mapbox/dark-v9', 'Dark'],
|
|
['mapbox://styles/mapbox/light-v9', 'Light'],
|
|
['mapbox://styles/mapbox/satellite-streets-v9', 'Satellite Streets'],
|
|
['mapbox://styles/mapbox/satellite-v9', 'Satellite'],
|
|
['mapbox://styles/mapbox/outdoors-v9', 'Outdoors'],
|
|
]
|
|
```
|
|
|
|
It is possible to set only mapbox by removing osm tiles and other way around.
|
|
|
|
:::warning
|
|
Setting `DECKGL_BASE_MAP` overwrite default values
|
|
:::
|
|
|
|
After defining your map tiles, set them in these variables:
|
|
- `CORS_OPTIONS`
|
|
- `connect-src` of `TALISMAN_CONFIG` and `TALISMAN_CONFIG_DEV` variables.
|
|
|
|
```python
|
|
ENABLE_CORS = True
|
|
CORS_OPTIONS: dict[Any, Any] = {
|
|
"origins": [
|
|
"https://tile.openstreetmap.org",
|
|
"https://tile.osm.ch",
|
|
"https://your_personal_url/{z}/{x}/{y}.png",
|
|
"https://tiles.api-maps.yandex.ru",
|
|
]
|
|
}
|
|
|
|
.
|
|
.
|
|
|
|
TALISMAN_CONFIG = {
|
|
"content_security_policy": {
|
|
...
|
|
"connect-src": [
|
|
"'self'",
|
|
"https://api.mapbox.com",
|
|
"https://events.mapbox.com",
|
|
"https://tile.openstreetmap.org",
|
|
"https://tile.osm.ch",
|
|
"https://your_personal_url/{z}/{x}/{y}.png",
|
|
"https://tiles.api-maps.yandex.ru",
|
|
],
|
|
...
|
|
}
|
|
```
|