Exemple #1
0
def build_app(gmaps_api_key='',
              digital_globe_api_key='',
              dgcs_connect_id='',
              planet_api_key='',
              sepal_host='',
              ee_account='',
              ee_key_path=''):

    app.config['GMAPS_API_KEY'] = gmaps_api_key
    app.config['DIGITALGLOBE_API_KEY'] = digital_globe_api_key
    app.config['DGCS_CONNECT_ID'] = dgcs_connect_id
    app.config['PLANET_API_KEY'] = planet_api_key
    app.config['SEPAL_HOST'] = sepal_host

    app.config['EE_ACCOUNT'] = ee_account
    app.config['EE_KEY_PATH'] = ee_key_path
    app.config['EE_TOKEN_ENABLED'] = True

    try:
        from gee_gateway import gee_gateway, gee_initialize
        gee_initialize(ee_account=ee_account, ee_key_path=ee_key_path)
        app.register_blueprint(gee_gateway,
                               url_prefix='/' + app.config['GEEG_API_URL'])
    except ImportError as e:
        pass

    return app
def build_app(gmaps_api_key='', ee_account='', ee_key_path=''):

    app.config['GMAPS_API_KEY'] = gmaps_api_key

    try:
        from gee_gateway import gee_gateway, gee_initialize
        gee_initialize(ee_account=ee_account, ee_key_path=ee_key_path)
        #app.register_blueprint(gee_gateway, url_prefix='/' + app.config['GEEG_API_URL'])
    except ImportError as e:
        pass

    return app
Exemple #3
0
from gee_gateway import gee_gateway, gee_initialize

if __name__ == '__main__':

    parser = argparse.ArgumentParser()
    parser.add_argument('--gmaps_api_key', action='store', default='', help='Google Maps API key')
    parser.add_argument('--ee_account', action='store', default='', help='Google Earth Engine account')
    parser.add_argument('--ee_key_path', action='store', default='', help='Google Earth Engine key path')
    parser.add_argument('--ee_token_enabled', action='store_false')
    args, unknown = parser.parse_known_args()

    app = Flask(__name__, instance_relative_config=True, static_url_path="/static", static_folder="./static")
    app.config.from_object('config')
    app.config.from_pyfile('config.py', silent=True)

    app.config['GMAPS_API_KEY'] = args.gmaps_api_key
    app.config['EE_ACCOUNT'] = args.ee_account
    app.config['EE_KEY_PATH'] = args.ee_key_path
    app.config['EE_TOKEN_ENABLED'] = args.ee_token_enabled

    if not args.ee_token_enabled:
        gee_initialize(ee_account=args.ee_account, ee_key_path=args.ee_key_path)
    gee_gateway_cors = CORS(gee_gateway, origins=app.config['CO_ORIGINS'])
    app.register_blueprint(gee_gateway)

    logging.basicConfig(level=app.config['LOGGING_LEVEL'])
    logging.getLogger('flask_cors').level = app.config['LOGGING_LEVEL']
    logging.getLogger('gee_gateway').level = app.config['LOGGING_LEVEL']

    app.run(debug=app.config['DEBUG'], port=app.config['PORT'], host=app.config['HOST'])