Google Earth Engine/App Engine set up

1. Authentication/Access

Follow the instructions below to set up your service account.
Request access to Earth Engine
Once you have set up your account, you can view your credentials (Account ID, email, keys) at the Console.
Add the Google EE account information to your environment variables:
In your .bashrc (.bash_profile on OSX), add these lines (xxxxxxx is your account number)


    #Google Earth Engine env
    export EE_SERVICE_ACCOUNT=xxxxxxx.apps.googleusercontent.com
    export EE_SERVICE_EMAIL= xxxxxxx@developer.gserviceaccount.com
    export EE_PRIVATE_KEY_FILE=/path_to_.pem_file
    

2.Installing the Earthengine API (Python)

2.1 Install anaconda

Anaconda helps you install and manage python and other packages. Anaconda is cool and helps manage dependencies between packages!

Get the latest anaconda version

2.2 Configure conda to use conda-forge

            conda update conda
            conda config --add channels conda-forge
        

2.3 Install the pip package manager

The earthengine api can only be installed with pip (and not with anaconda). That's why we need pip on top of anaconda

conda install pip

2.4 Install the earthengine api

pip install earthengine-api

2.5 Test the installation

            python
            import ee
            ee.Initialize()
        

Install the Google App Engine SDK

App Engine SDK Downloads

Note: The Python SDK does not contain the Launcher anymore. You will need to dev_appserver.py run on localhost and deploy to the appsot server. If you are on MAC, you get install the App Engine SDK via the PHP SDK instead. That will give you the launcher as well as the dev_appserver commandline utility.

Creating a conda environment for Earthengine API

This will allow you to create your own python environment with versions of python packages that match the versions on the app engine server. in the example below we creat the env ee-env. It will be installed by conda in $(PATH_TO_ANACONDA_INSTALLATION)/envs

    conda create -n ee-env python=2.7
    source activate ee-env
    

Now that you have set up this basic python env, you will need to install some packages there that Earthengine needs in this environment

    conda install httplib2 oauth2client jinja2 cryptography numpy=1.6.2 
    pip install earthengine-api
    

To use the Launcher with this environment, make sure the python path in the lunacher is set correctly: go to GoogleAppEngineLauncher--> Preferences --> Python Path. Enter $(PATH_TO_ANACONDA_INSTALLATION)/envs/ee-env/bin/python2.7. Make sure to hit Enter for the changes to take effect If you are using dev_appserver.py from the commandline, make sure that you sourced the environment before running it:

source ee-env

Set up the Hello World project

Quickstart for Python App Engine Standard Environment

Setting up project libraries

Alternatively, you can set up your own library ($(PROJECT_DIR)/ee-lib) directly in the project directory and install earthengine-api there. This should help you avoid version differences between your local machine and the appengine server. It also was the only way I could take care of the oauth2client issue I ran into the last time I installed the EE software. This issue is described here and also here

    cd $(PROJECT_DIR)
    pip install earthengine-api -t ./ee-lib
    

Create or modify the appengine_config.py and add these lines:

    from google.appengine.ext import vendor

    vendor.add('ee-lib')
    

You may need to install pycrypto again and you may need to revert back to an earlier version of oauth2client.

    pip install pycrypto -t ./ee-lib 
    pip install oauth2client==1.5.2 -t ./ee-lib