28 publish map
Uncomment the following line to install leafmap if needed.
In [1]:
Copied!
# !pip install leafmap
# !pip install leafmap
To follow this tutorial, you will need to sign up for an account with https://datapane.com, then install and authenticate the datapane
Python package. More information can be found here.
pip install datapane
datapane login
datapane ping
In [2]:
Copied!
import leafmap.foliumap as leafmap
import leafmap.foliumap as leafmap
Create an elevation map of North America.
In [3]:
Copied!
m = leafmap.Map()
m.add_basemap('USGS 3DEP Elevation')
colors = ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']
vmin = 0
vmax = 4000
m.add_colorbar(colors=colors, vmin=vmin, vmax=vmax)
m
m = leafmap.Map()
m.add_basemap('USGS 3DEP Elevation')
colors = ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']
vmin = 0
vmax = 4000
m.add_colorbar(colors=colors, vmin=vmin, vmax=vmax)
m
Out[3]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Publish the map to datapane.com
In [4]:
Copied!
m.publish(name="Elevation Map of North America")
m.publish(name="Elevation Map of North America")
Connected successfully to https://datapane.com as giswqs
Bokeh version 2.4.2 is not supported, these plots may not display correctly, please install version ~=2.2.0
Uploading report and associated data - please wait...
Your report only contains a single element - did you know you can include additional plots, tables and text in a single report? More info here
Create a land use and land cover map.
In [5]:
Copied!
m = leafmap.Map()
m.add_basemap("NLCD 2016 CONUS Land Cover")
m.add_legend(builtin_legend='NLCD')
m
m = leafmap.Map()
m.add_basemap("NLCD 2016 CONUS Land Cover")
m.add_legend(builtin_legend='NLCD')
m
Out[5]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Publish the map to datapane.com.
In [6]:
Copied!
m.publish(name="National Land Cover Database (NLCD) 2016")
m.publish(name="National Land Cover Database (NLCD) 2016")
Create a world population heat map.
In [7]:
Copied!
m = leafmap.Map()
in_csv = "https://raw.githubusercontent.com/giswqs/leafmap/master/examples/data/world_cities.csv"
m.add_heatmap(
in_csv,
latitude="latitude",
longitude='longitude',
value="pop_max",
name="Heat map",
radius=20,
)
m = leafmap.Map()
in_csv = "https://raw.githubusercontent.com/giswqs/leafmap/master/examples/data/world_cities.csv"
m.add_heatmap(
in_csv,
latitude="latitude",
longitude='longitude',
value="pop_max",
name="Heat map",
radius=20,
)
In [8]:
Copied!
colors = ['blue', 'lime', 'red']
vmin = 0
vmax = 10000
m.add_colorbar(colors=colors, vmin=vmin, vmax=vmax)
m
colors = ['blue', 'lime', 'red']
vmin = 0
vmax = 10000
m.add_colorbar(colors=colors, vmin=vmin, vmax=vmax)
m
Out[8]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Publish the map to datapane.com.
In [9]:
Copied!
m.publish(name="World Population Heat Map")
m.publish(name="World Population Heat Map")
Last update:
2022-03-14