basemaps module¶
leafmap.basemaps
¶
Module for basemaps.
Each basemap is defined as an item in the basemaps dictionary.
For example, to access Google basemaps, users first need to get a Google Maps API key from https://bit.ly/3sw0THG.
Then, set the environment variable using geemap.set_api_key(
1 2 3 4 | |
More WMS basemaps can be found at the following websites:
- USGS National Map: https://viewer.nationalmap.gov/services/
- MRLC NLCD Land Cover data: https://viewer.nationalmap.gov/services/
- FWS NWI Wetlands data: https://www.fws.gov/wetlands/Data/Web-Map-Services.html
TileLayer
¶
Bases: TileLayer
An ipyleaflet TileLayer that exposes Leaflet's referrerPolicy option.
The OpenStreetMap tile servers reject requests without a Referer
header and return an "Access blocked" tile instead. Some notebook
environments, such as Google Colab, render widget output in an iframe
whose referrer policy strips the header. Setting referrerPolicy on
the tile <img> elements overrides the page policy so the origin is
sent again. See https://wiki.openstreetmap.org/wiki/Blocked_tiles.
get_osm_layer(**kwargs)
¶
Create an OpenStreetMap tile layer that sends a Referer header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Additional keyword arguments passed to TileLayer. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
TileLayer |
TileLayer
|
The OpenStreetMap tile layer. |
get_xyz_dict(free_only=True, france=False)
¶
Returns a dictionary of xyz services.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
free_only
|
bool
|
Whether to return only free xyz tile services that do not require an access token. Defaults to True. |
True
|
france
|
bool
|
Whether to include Geoportail France basemaps. Defaults to False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary of xyz services. |
qms_to_geemap(service_id)
¶
Convert a qms service to an ipyleaflet tile layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service_id
|
str
|
Service ID. |
required |
Returns:
| Type | Description |
|---|---|
TileLayer
|
ipyleaflet.TileLayer: An ipyleaflet tile layer. |
search_qms(keywords, limit=10, timeout=600)
¶
Search qms files for keywords. Reference: https://github.com/geopandas/xyzservices/issues/65
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keywords
|
str
|
Keywords to search for. |
required |
limit
|
int
|
Number of results to return. |
10
|
xyz_to_bokeh()
¶
Convert xyz tile services to bokeh tile layers.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary of bokeh tile layers. |
xyz_to_folium()
¶
Convert xyz tile services to folium tile layers.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary of folium tile layers. |
xyz_to_leaflet()
¶
Convert xyz tile services to ipyleaflet tile layers.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary of ipyleaflet tile layers. |
xyz_to_plotly()
¶
Convert xyz tile services to plotly tile layers.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary of plotly tile layers. |
xyz_to_pydeck()
¶
Convert xyz tile services to pydeck custom tile layers.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary of pydeck tile layers. |