本文主要介绍一下基本的底图加载和应用工具使用~
① basemap所有底图展示一,具体代码如下所示:
basemaps = geemap.basemaps
for basemap in basemaps:
print(basemap)
# ROADMAP
# SATELLITE
# TERRAIN
# HYBRID
# ESRI
# Esri Ocean
# Esri Satellite
# Esri Standard
# Esri Terrain
# Esri Transportation
# Esri Topo World
# Esri National Geographic
# Esri Shaded Relief
# Esri Physical Map
# FWS NWI Wetlands
# FWS NWI Wetlands Raster
# Google Maps
# Google Satellite
# Google Terrain
# Google Satellite Hybrid
# NLCD 2016 CONUS Land Cover
# NLCD 2013 CONUS Land Cover
# NLCD 2011 CONUS Land Cover
# NLCD 2008 CONUS Land Cover
# NLCD 2006 CONUS Land Cover
# NLCD 2004 CONUS Land Cover
# NLCD 2001 CONUS Land Cover
# USGS NAIP Imagery
# USGS Hydrography
# USGS 3DEP Elevation
# OpenStreetMap.Mapnik
# OpenStreetMap.BlackAndWhite
# OpenStreetMap.DE
# OpenStreetMap.France
# OpenStreetMap.HOT
# Gaode.Normal
# Gaode.Satellite
# OpenTopoMap
# Hydda.Full
# Hydda.Base
# Esri.WorldStreetMap
# Esri.DeLorme
# Esri.WorldTopoMap
# Esri.WorldImagery
# Esri.NatGeoWorldMap
# HikeBike.HikeBike
# MtbMap
# CartoDB.Positron
# CartoDB.DarkMatter
# NASAGIBS.ModisTerraTrueColorCR
# NASAGIBS.ModisTerraBands367CR
# NASAGIBS.ModisTerraBands721CR
# NASAGIBS.ModisAquaTrueColorCR
# NASAGIBS.ModisAquaBands721CR
# NASAGIBS.ViirsTrueColorCR
# NASAGIBS.ViirsEarthAtNight2012
# NASAGIBS.BlueMarble3413
# NASAGIBS.BlueMarble3031
# NASAGIBS.BlueMarble
# Strava.All
# Strava.Ride
# Strava.Run
# Strava.Water
# Strava.Winter
# Stamen.Terrain
# Stamen.Toner
# Stamen.Watercolor
② basemap所有底图展示二,具体代码如下所示:
# class 02_2 所有basemap的展示
import geemap
m = geemap.Map()
m.basemap_demo()
m
在geemap中加载basemap所有底图,可自行选择红色框内的底图,在geemap中加载,如下图所示:
① 通过上图所有底图数据的列表,任选其中某个底图就可以加载,具体代码如下:
# class 02_1 加载某个basemap数据
import geemap
Map = geemap.Map(center=[40,100], zoom=4)
Map.add_basemap("OpenStreetMap")
Map
① 通过获取对应WMS对应的网址输入url、layers、name等信息,即可加载basemap以外的WMS底图,具体代码如下:
#class 02_3 geemap加载WMS数据底图
import geemap
Map = geemap.Map(center=[40,-100], zoom=4)
Map.add_basemap("ROADMAP")
naip_url = 'https://basemap.nationalmap.gov:443/arcgis/services/USGSHydroCached/MapServer/WmsServer?'
Map.add_wms_layer(url=naip_url, layers='0', name='USGS Imagery', format='image/png', shown=True)
Map
① 运行下面代码加载底图影像;
② 加载页面右上角的地方选择inspector tool 工具,可在地图中点选,即可出现这个点在各个图层的相关信息。
#class 03 加载不同的图层,并介绍inspector tool的使用
import geemap
import ee
m = geemap.Map()
m.add_basemap("ROADMAP")
# Add Earth Engine dataset
dem = ee.Image('USGS/SRTMGL1_003')
landcover = ee.Image("ESA/GLOBCOVER_L4_200901_200912_V2_3").select('landcover')
landsat7 = ee.Image('LE7_TOA_5YEAR/1999_2003').select(
['B1', 'B2', 'B3', 'B4', 'B5', 'B7']
)
states = ee.FeatureCollection("TIGER/2018/States")
# Set visualization parameters.
vis_params = {
'min': 0,
'max': 4000,
'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5'],
}
# Add Earth Eninge layers to Map
Map.addLayer(dem, vis_params, 'SRTM DEM', True, 0.5)
Map.addLayer(landcover, {}, 'Land cover')
Map.addLayer(
landsat7,
{'bands': ['B3', 'B2', 'B1'], 'min': 20, 'max': 200, 'gamma': 2.0},
'Landsat 7',
)
Map.addLayer(states, {}, "US States")
Map
Split panel适合在可视化时同时对比效果,而且可以通过拖动,改变两边图像显示范围,可谓高大上可视化以及分析结果的利器。
#class 04_1 split_panel_map
import geemap
Map = geemap.Map()
Map.split_map(left_layer='HYBRID', right_layer='ROADMAP')
Map
① 通过split_panel工具,研究2001-2016年土地覆被变化图
# class 04_3 加载2001-2016年土地覆被变化图(通过split_panel)
Map = geemap.Map()
Map.split_map(
left_layer='NLCD 2016 CONUS Land Cover',
right_layer='NLCD 2001 CONUS Land Cover'
)
Map