使用Python嵌入Google地球

问题描述 投票:0回答:2

有没有办法在Google桌面应用程序中嵌入Google Earth或Google Earth Engine?

截至目前,我已经创建了一个带有经度/纬度数据的kml文件,可以手动将其放入Google地球专业版以跟踪GPS的路径。

我看过很多论坛帖子,其中Google Earth嵌入在网页中而不是桌面应用程序中,因此我想知道是否可以完成。

任何建议,将不胜感激

python google-earth google-earth-engine
2个回答
0
投票

两秒谷歌搜索发现了这个!因此,在回答您的问题时,是的,您可以在Python中使用Google地球

https://developers.google.com/earth-engine/python_install


0
投票

是的,您可以将Google地球引擎结果添加到桌面应用程序,只要它支持WMS图块图层,图像或图形。

以下是一些假设您已经完成这些预处理步骤的示例:

import ee
ee.Initialize() # note: may have initialize with a service account within an application

# ee Image object of the Global SRTM data
img = ee.Image("USGS/SRTMGL1_003")

获取WMS磁贴:

# get map tile id and token with specific color palette
# arguments into "getMapId" are the same as the JavaScript API "Map.addLayer"
result = img.getMapId({'min': 0, 'max': 3000})
url = "https://earthengine.googleapis.com/map/{mapid}/{{z}}/{{x}}/{{y}}?token={token}"
tiles = url.format(**result)
print(tiles)

 # visualize in your favorite application that supports WMS

获取静态图片:

# Generate a URL that displays a static Image from Global DEM
url = img.getThumbUrl({'min':0, 'max':3000})

# create a file-like object from the url
import urllib2
f = urllib2.ulropen(url)

# Display the image using matplotlib
import matplotlib.pyplot as plt
result = plt.imread(f)
plt.imshow(result)
plt.show()

显示时间序列图可能会涉及更多:

# get a collection with time series
collection = ee.ImageCollection('MODIS/006/MOD11A2')\
                 .filterDate('2016-01-01','2018-01-01')

# create a geometry of area to show time series
atl = ee.Geometry.Point([-84.3880,33.7490])

# get a time series over the point
result = collection.select('LST_Day_1km').getRegion(atl,1000).getInfo()

# turn the result into a pandas dataframe and manipulate results for plotting
import pandas as pd
df = pd.DataFrame(result[1:])
df.columns = result[0]

# convert epoch time to a format for pandas
dates = [pd.Timestamp(t*1000000) for t in df.time]
# make new pandas series object with scaled LST values
ts = pd.Series(np.array(df.LST_Day_1km)*0.02-273.15,index=dates,name='lst')
ts.index.name = 'Date'

# finally display results
ts.plot()

可能有更有效的方法来获取结果并在应用程序中显示,但是,这可能是一种让您入门的方法。

© www.soinside.com 2019 - 2024. All rights reserved.