Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed Google Earth Engine application into web page

Is there a simpler way to embed a Google Earth Engine (javascript) application into a web page without following the tortured route presented by the Google EE demo apps?

The Earth Engine Code environment makes it quick and fast to develop the core GEE app. However, it's going to take me 10x the time to embed the GEE app into a web page than it took to do the GEE app.

All the demo apps seem to require (a) using Google App Engine, (b) recoding the GEE app in Python, (c) using jinja2 templating engine to link the python code to the web page, and (d) still some lingering javascript.

For example, in the Trendy Lights demo, the server-side scripter server.py App Engine kicks things off and it gets complicated quickly. (Even the simpler demos go this route.)

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.

like image 968
Biofloat Avatar asked Mar 05 '16 19:03

Biofloat


1 Answers

The reason it's complicated is due to authorization. The Earth Engine calls have to be authorized against someone's Earth Engine account. That has to be either the end user (See: https://github.com/google/earthengine-api/tree/master/demos/client-auth, but that only works if the end user has an Earth Engine account), or the application's credentials. If the application's credentials were just stuck in the javascript, then anyone can steal those credentials and use them to do anything they wanted. So we recommend using the appengine server-auth route (https://github.com/google/earthengine-api/tree/master/demos/server-auth) to keep your credentials safe.

like image 115
Noel Gorelick Avatar answered Oct 06 '22 00:10

Noel Gorelick