Google earth engine (GEE) 在Pycharm 中显示地图map

在pycharm环境中,通过folium和webbrowser实现显示GEE的map。即先将folium中的map保存为html格式,然后通过webbrowser在浏览器中打开


import ee

import folium

import webbrowser


ee.Initialize()

print('Folium Version: ', folium.__version__)

# Use these bands for prediction.

bands = ['B2', 'B3', 'B4', 'B5', 'B6', 'B7']

# Use Landsat 8 surface reflectance data.

l8sr = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')

# The image input data is a 2018 cloud-masked median composite.

image = l8sr.filterDate('2018-01-01', '2018-12-31').map(maskL8sr).median()

# Use folium to visualize the imagery.

mapIdDict = image.getMapId({'bands': ['B4','B3','B2'],'min':0,'max':0.3})

map = folium.Map(location=[48., -122.5])

folium.TileLayer(

    tiles=mapIdDict['tile_fetcher'].url_format,

    attr='Map Data © Google Earth Engine',

    overlay=True,

    name='median composite',

  ).add_to(map)

map.add_child(folium.LayerControl())

#  利用map.save 将map保存为html:"Landsat 8 images.html"

map.save("Landsat 8 images.html") 

#  webbrowser中打开"Landsat 8 images.html"

webbrowser.open("Landsat 8 images.html")

你可能感兴趣的:(Google earth engine (GEE) 在Pycharm 中显示地图map)