数据源 earth文件
Editor’s note: Today’s post is by Ib Green, CTO, and Kyle Barron, Software Engineer, both at Unfolded, an “open core” company that builds products and services on the open source deck.gl / vis.gl technology stack, and is also a major contributor to these frameworks. Green and Barron explain Google and Unfolded’s new open source framework, earthengine-layers, which enables Google Earth Engine to be used in combination with deck.gl to build a new generation of visualization applications.
编者按: 今天的帖子由 CTO Ib Green 和软件工程师Kyle Barron共同组成, Unfolded 是一家“开放式核心”公司,该公司在开放源代码deck.gl/vis.gl技术堆栈上构建产品和服务,并且也是这些框架的主要贡献者。 Green和Barron解释了Google和 Unfolded 的新开源框架 Earthengine-layers ,该 框架 使Google Earth Engine与eck.gl结合使用可以构建新一代的可视化应用程序。
When Unfolded got the opportunity to collaborate with Google on a deck.gl / Earth Engine integration, we did not hesitate. Deck.gl is a GPU-powered geospatial visualization framework for large-scale geospatial data, and it had long been clear to us that making the spectacular data available through the Earth Engine API accessible in deck.gl visualizations would be very powerful, and would open up new important new use cases.
当Unfolded获得机会在deck.gl/Earth Engine集成中与Google合作时,我们毫不犹豫。 Deck.gl是用于大型地理空间数据的GPU驱动的地理空间可视化框架,我们很早就知道,通过eck.gl中可访问的Earth Engine API提供壮观的数据将非常强大,并且会打开新的重要的新用例。
While the visualization that comes with the Earth Engine Code Editor is already very versatile, it is most optimized for high-performance visualization of raster vector tiles generated by the Earth Engine cloud on top of flat maps. The deck.gl integration adds a number of new capabilities:
虽然Earth Engine代码编辑器随附的可视化功能已经非常通用,但它已针对在平面地图上由Earth Engine云生成的栅格矢量图块的高性能可视化进行了最优化。 deck.gl集成增加了许多新功能:
Toolbox: deck.gl is a toolbox that lets you build complete visualization applications.
工具箱: deck.gl是一个工具箱,可让您构建完整的可视化应用程序。
Vector data support: Earth Engine data rendered as true vector geometries.
向量数据支持:呈现为真实向量几何的Earth Engine数据。
Layer combinations: deck.gl allows visual layers showing different data sources to be freely combined. This brings the ability to render raster data as an image-based backdrop, and then overlay it with vector data rendered as true vector geometries.
图层组合: deck.gl允许自由组合显示不同数据源的可视图层。 这样就可以将栅格数据渲染为基于图像的背景,然后将其与渲染为真实矢量几何图形的矢量数据叠加。
Beyond 2D tiles: The deck.gl APIs also provide rich interactivity, enhanced animations, and even the ability to interpret Earth Engine data as terrain elevations and display them in full 3D.
超越2D磁贴: deck.gl API还提供了丰富的交互性,增强的动画效果,甚至还可以将Earth Engine数据解释为地形高程并以完整3D形式显示。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/0e612e93a9b666dba2c0487cdff7ed70.png)
deck.gl TerrainLayer
and displayed in perspective view.
deck.gl TerrainLayer
将
Earth Engine栅格图块解释为高程数据,
并以透视图显示。
同时支持Python和JavaScript API (Support for both Python and JavaScript APIs)
While web visualizations are typically programmed in JavaScript, Earth Engine has a big Python-focused community of data scientists. The fact that both the Earth Engine and the deck.gl APIs now have JavaScript and Python bindings allowed us to support both communities with a single integration effort.
虽然通常使用JavaScript对网络可视化进行编程,但Earth Engine拥有一个以Python为中心的大型数据科学家社区。 现在,Earth Engine和deck.gl API都具有JavaScript和Python绑定这一事实使我们能够通过一次集成工作来支持这两个社区。
在JavaScript中使用EarthEngineLayer (Using the EarthEngineLayer in JavaScript)
The new EarthEngineLayer
is a normal JavaScript deck.gl layer that can be imported into and used in any deck.gl application, instantiated with an Earth Engine JavaScript object, and of course, used in combination with any other existing deck.gl layers.
新的EarthEngineLayer
是一个普通JavaScript deck.gl层,可以将其导入到任何eck.gl应用程序中并在其中使用,可以使用Earth Engine JavaScript对象实例化,当然也可以与任何其他现有的deck.gl层结合使用。
import React from 'react';
import DeckGL from '@deck.gl/react';
import {EarthEngineLayer} from '@unfolded.gl/earthengine-layers';
import ee from '@google/earthengine';export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {eeObject: null};
} async _onLoginSuccess(user, loginProvider) {
const token = 'Google OAuth2 access token'
await EarthEngineLayer.initializeEEApi(
{clientId: EE_CLIENT_ID, token});
this.setState({eeObject: ee.Image('CGIAR/SRTM90_V4')});
} render() {
const {viewport} = this.props;
const {eeObject} = this.state;
const visParams = {
min: 0,
max: 4000,
palette: ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']
};
const layers = [new EarthEngineLayer({eeObject, visParams})];
return (
<DeckGL controller {...viewport} layers={layers}/>
);
}
}
Note: this example uses deck.gl’s React bindings, but it can also be written in pure JavaScript.
注意:这个例子使用了deck.gl的React绑定,但是它也可以用纯JavaScript编写。
在Python中使用EarthEngineLayer (Using the EarthEngineLayer in Python)
Deck.gl provides Python bindings through pydeck. The new pydeck_earthengine_layers
add-on module is available on both pip and conda.
Deck.gl通过pydeck提供Python绑定。 新的pydeck_earthengine_layers
附加模块可在pip和conda上使用。
All the application needs to do is to pass its ‘ee’
API object to the EarthEngineLayer
together with a few visualization parameters, and then pass that Earth Engine layer instance to pydeck’s Deck class.
所有程序需要做的是它的通过'ee'
API对象到EarthEngineLayer
与一些可视化的参数一起,然后传递地球引擎层实例pydeck的甲板类。
from pydeck_earthengine_layers import EarthEngineLayer
import pydeck as pdk
import eeee.Initialize()image = ee.Image('CGIAR/SRTM90_V4')
vis_params = {
"min": 0,
"max": 4000,
'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']
}
ee_layer = EarthEngineLayer(image, vis_params)
view_state = pdk.ViewState(latitude=37.7749295, longitude=-122.4194155, zoom=10, bearing=0, pitch=45)
r = pdk.Deck(
layers=[ee_layer],
initial_view_state=view_state
)r.show()
Under the hood, the EarthEngineLayer
converts Earth Engine Python API objects into Earth Engine JavaScript API objects that can be manipulated by deck.gl and are then used to retrieve Earth Engine data for display. The standard pydeck API can be used to control and interact with the EarthEngineLayer
.
在引擎盖下, EarthEngineLayer
将Earth Engine Python API对象转换为Earth引擎JavaScript API对象,这些对象可以由deck.gl操纵,然后用于检索Earth Engine数据以进行显示。 标准pydeck API可用于控制EarthEngineLayer
并与EarthEngineLayer
交互。
卫星数据的力量 (The power of satellite data)
The combination of Google Earth Engine and deck.gl enables effortless visualization of huge geospatial datasets. The selection of datasets in Earth Engine is very rich, and the processing features of the Earth Engine API also allow for custom data to be synthesized from the existing catalogs, so the potential for exploration is huge.
Google Earth Engine和deck.gl的结合使您可以轻松地可视化巨大的地理空间数据集。 Earth Engine中数据集的选择非常丰富,并且Earth Engine API的处理功能还允许从现有目录中合成自定义数据,因此勘探潜力巨大。
This section shows just a few examples that were built to demonstrate the capabilities of using deck.gl and Earth Engine together.
本部分仅显示了一些示例,这些示例旨在演示结合使用deck.gl和Earth Engine的功能。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/e866b6d74418cd6a1805ac9d76ca1000.png)
Traditionally, Earth Engine visualizations are raster-based. Deck.gl provides the ability to mix raster and vector-based graphics. The improved clarity of vector-based graphics combined with rich styling (including 3D extrusions and elevations) and also interactivity (informational tooltips when hovering) can open up new visualization applications.
传统上,Earth Engine可视化是基于栅格的。 Deck.gl提供了混合栅格和基于矢量的图形的功能。 基于矢量的图形的改进的清晰度与丰富的样式(包括3D拉伸和高程)以及交互性(悬停时的信息工具提示)相结合,可以开拓新的可视化应用程序。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/52e7703abc63b97090849670647e1e0a.png)
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/88f0da271d0b3f5a3cfa5ae161d1fa25.png)
与vis.gl社区互动 (Engage with the vis.gl community)
We look forward to seeing what the community builds with the new earthengine-layers framework, bringing planetary-scale satellite-based data to bear on new geospatial problems and applications. If you want to share examples of your work, feel free to engage with us on GitHub; we may be able to host a link to your showcase.
我们期待看到社区使用新的Earthengine-layers框架构建的功能,并将基于行星规模的基于卫星的数据用于新的地理空间问题和应用。 如果您想分享您的工作实例,请随时在GitHub上与我们联系; 我们也许可以托管一个到您的展示柜的链接。
Links
链接
数据源 earth文件