opengeos / leafmap

A Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment
https://leafmap.org
MIT License
3.2k stars 379 forks source link

Improve add_basemap for supporting xyzservices provider object #92

Closed giswqs closed 3 years ago

giswqs commented 3 years ago

Any chance we could support passing the provider object as m.add_basemap(xyz.BasemapAT.basemap)? That allows passing basemaps requiring tokens for example.

From @martinfleis https://twitter.com/martinfleis/status/1423263789579972611

giswqs commented 3 years ago

@martinfleis This feature has been implemented. Users can pass an xyzservices provider object to the add_basemap() function. It supports three plotting backends, i.e., ipyleaflet, folium, and heremap @sackh

https://leafmap.org/notebooks/02_using_basemaps/

import os
import leafmap
import xyzservices.providers as xyz

basemap = xyz.HEREv3.basicMap
basemap['apiKey'] = os.environ["HEREMAPS_API_KEY"]

m = leafmap.Map()
m.add_basemap(basemap)
m

image