是否可以将Google Earth或Google Earth Engine嵌入Python桌面应用程序中?
到目前为止,我已经创建了一个包含经度/纬度数据的kml文件,可以将其手动放入Google Earth Pro中以跟踪GPS的路径。
我见过很多论坛帖子,其中Google Earth嵌入网页中,而不嵌入桌面应用程序中,所以我想知道是否可以这样做。
任何建议将不胜感激
答案 0 :(得分:0)
两秒钟的Google搜索发现了这个!因此,为回答您的问题,是的,您可以在Python中使用Google Earth
答案 1 :(得分:0)
是的,您可以将Google Earth Engine结果添加到桌面应用程序中,只要它支持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()
可能有更有效的方法来获取结果并在应用程序中显示,但是,这可能是入门的一种方法。