javascript - 将 Google Earth Engine 应用程序嵌入到网页中

标签 javascript google-earth-engine

有没有一种更简单的方法可以将 Google 地球引擎 (javascript) 应用程序嵌入到网页中,而无需遵循 Google EE demo apps 提供的折磨路线? ?

Earth Engine Code环境使得开发核心 GEE 应用程序变得快速而快速。但是,将 GEE 应用程序嵌入网页所花费的时间是编写 GEE 应用程序所花费时间的 10 倍。

所有演示应用程序似乎都需要 (a) 使用 Google App Engine ,(b)用 Python 重新编码 GEE 应用程序,(c)使用 jinja2 模板引擎将 python 代码链接到网页,以及(d)仍然有一些挥之不去的 javascript。

例如,在 Trendy Lights demo ,服务器端脚本程序 server.py App Engine 启动并很快变得复杂。 (即使是更简单的演示也走这条路。)

When the user first loads the application in their browser, their request is routed to the get() function in the MainHandler class by the framework we're using, webapp2.

The get() function sends back the main web page (from index.html) along with information the browser needs to render an Earth Engine map and the IDs of the polygons to show on the map. This information is injected into the index.html template through a templating engine called Jinja2, which puts information from the Python context into the HTML for the user's browser to receive.

最佳答案

之所以复杂,是因为授权。 Earth Engine 调用必须针对某人的 Earth Engine 帐户进行授权。这必须是最终用户(请参阅:https://github.com/google/earthengine-api/tree/master/demos/client-auth,但只有当最终用户拥有 Earth Engine 帐户时才有效)或应用程序的凭据。如果应用程序的凭据只是卡在 javascript 中,那么任何人都可以窃取这些凭据并使用它们来做任何他们想做的事情。因此,我们建议使用 appengine server-auth 路由 ( https://github.com/google/earthengine-api/tree/master/demos/server-auth ) 来确保您的凭据安全。

关于javascript - 将 Google Earth Engine 应用程序嵌入到网页中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35819060/

相关文章:

python - 无法在 Windows 的 Linux 子系统中安装 Google-Earth-Engine-Api

python - 如何在 Google Earth Engine 中使用 Python 导出结果

javascript - 为屏幕而不是打印媒体切换 CSS 显示

javascript - 镜像多个选择字段 jquery/javascript

javascript - 谷歌地球引擎: Finding the right image dimensions to get max resolution on satellite imagery

javascript - 如何从 Google Earth Engine 下载特定多边形的哨兵 1

python-imaging-library - 为谷歌地球引擎导入 ImageTk

javascript - Codeigniter - 如何使用 javascript 变量重定向到 Controller ?($this->load->view() 不工作)

javascript - 奇怪的 ES6 Array.every 行为

asp.net - javascript循环仅适用于所有其他元素