This package provides an API for storing and querying geographic data structures as simple features.
Note - this is a demo in early development
Requirements:
- Unix system with bash or sh
- Docker
- Docker compose
Optional:
- A Google cloud account (and project) with IAM permissions
- An Amazon cloud account with IAM permissions
TODO: Update instructions!
-
Create a Google Cloud service account for your project, see service accounts.
-
Download the service account credentials and save to
credentials.json
in the root of this directory. -
Register the service account to use Earth Engine, using this page.
-
Copy (or clone) your earthengine functions to
helper_functions.js
- add
const ee = require('@google/earthengine');
to the start of this file. - If you use a different file name or add more files you need to update the
Dockerfile
:COPY package.json package-lock.json credentials.json index.js helper_functions.js ./
andindex.js
:const hfs = require('./helper_functions.js')
. - It is best practice to fully document and test your main functions.
- add
-
Edit the
index.js
file;- Define which parameters are passed from the REST query (and optionally give defaults or errors), in the section
REST WRAPPER
>>PARAMETERS
. - Add your analysis code in
REST WRAPPER
>>ANALYSIS
>>ANALYSIS CODE
- For debugging you can use asyncrouous printing of ee objects to console. Note for feature collections you may need to use
.limit()
to see results. - Usually it is best practice to convert the params to ee objects for use in functions.
- Calling
ee.imageCollection
,ee.image
andee.featureCollection
via dictionary selectors can cause problems, consider using switch.
- For debugging you can use asyncrouous printing of ee objects to console. Note for feature collections you may need to use
- Define which parameters are passed from the REST query (and optionally give defaults or errors), in the section
-
Start the application by cd'ing to this directory, opening a terminal, and runnning:
sh ./start.sh dev
-
Either go to the local URL shown in the terminal or use another terminal with curl or a tool such as POSTMAN.
- Using a browser the form of the call is:
URL?param1=value¶m2=value
. - Using curl the form of the call is:
URL\?param1=value¶m2=value
.
- Using a browser the form of the call is: