In [1]:
Copied!
# %pip install "leafmap[maplibre]"
# %pip install "leafmap[maplibre]"
In [2]:
Copied!
import requests
import leafmap.maplibregl as leafmap
import requests
import leafmap.maplibregl as leafmap
In [3]:
Copied!
# import os
# os.environ["MAPTILER_KEY"] = "YOUR_API_KEY"
# import os
# os.environ["MAPTILER_KEY"] = "YOUR_API_KEY"
In [4]:
Copied!
url = (
"https://github.com/opengeos/datasets/releases/download/world/world_cities.geojson"
)
geojson = requests.get(url).json()
url = (
"https://github.com/opengeos/datasets/releases/download/world/world_cities.geojson"
)
geojson = requests.get(url).json()
In [5]:
Copied!
m = leafmap.Map(style="streets")
source = {"type": "geojson", "data": geojson}
layer = {
"id": "cities",
"type": "symbol",
"source": "point",
"layout": {
"icon-image": "marker_15",
"icon-size": 1,
},
}
m.add_source("point", source)
m.add_layer(layer)
m.add_popup("cities")
m
m = leafmap.Map(style="streets")
source = {"type": "geojson", "data": geojson}
layer = {
"id": "cities",
"type": "symbol",
"source": "point",
"layout": {
"icon-image": "marker_15",
"icon-size": 1,
},
}
m.add_source("point", source)
m.add_layer(layer)
m.add_popup("cities")
m
Failed to retrieve the MapTiler style. Defaulting to OpenFreeMap 'liberty' style.