Skip to content

Microservice for on the fly analysis and download of Terra I forest change data

Notifications You must be signed in to change notification settings

gfw-api/forest-change-analysis-elastic

Repository files navigation

Terra I Analysis API Microservice Overview

Build Status Test Coverage

Query the Terra I forest loss dataset with the Global Forest Watch (GFW) API

NB: This repo used to handle GLAD analysis requests as well - this functionality has been moved here.

  • Analyze datasets by a custom area of interest using the GFW Geostore API or by sending GeoJson in Post
  • Analyze datasets by Country, State and Districts (defined by the GADM Database)
  • Analyze datasets by GFW Land Use features (Managed Forest Concessions, Oil Palm Concessions, Mining Concessions and Wood Fiber Concessions- available in select countries)
  • Analyze datasets by Protected Areas (defined by the WDPA database)
  • Get dataset download urls (csv and json) for areas of interest
  • Summarize analysis results by day, week, month, quarter or year
  • Get dataset date range/ latest date

Dependencies

Dependencies on other Microservices:

API Endpoints

For endpoint documentation, please visit our API documentation page for TerraI

Getting Started

Perform the following steps:

  • Install docker
  • Install control tower
  • Clone this repository: git clone https://github.com/gfw-api/forest-change-analysis-elastic.git
  • Enter the directory (cd forest-change-analysis-elastic)
  • Change the GATEWAY_URL and Port in the docker-compose-develop.yml and docker-compose.yml and Dockerfile to your machine and port #
  • Open a terminal (if you have mac or windows, open a terminal with the 'Docker Quickstart Terminal') and run the gladanalysis.sh shell script in development mode:
./gladanalysis.sh develop

If this is the first time you run it, it may take a few minutes.

Testing

Testing API endpoints

./gladanalysis.sh test

Config

register.json

This is the configuration file for the rest endpoints in the microservice. This json connects to the API Gateway. It contains variables such as:

  • #(service.id) => Id of the service set in the config file by environment
  • #(service.name) => Name of the service set in the config file by environment
  • #(service.uri) => Base uri of the service set in the config file by environment

Example:

{
    "id": "#(service.id)",
    "name": "#(service.name)",
    "tags": ["gfw"],
    "urls": [{
        "url": "/v1/terrai-alerts/admin/:iso_code",
        "method": "GET",
        "endpoints": [{
            "method": "GET",
            "path": "/api/v2/ms/terrai-alerts/admin/:iso_code"
        }]
    }, {
        "url": "/v1/terrai-alerts/admin/:iso_code/:admin_id",
        "method": "GET",
        "endpoints": [{
            "method": "GET",
            "path": "/api/v2/ms/terrai-alerts/admin/:iso_code/:admin_id"
        }]
    }, {
        "url": "/v1/terrai-alerts/admin/:iso_code/:admin_id/:dist_id",
        "method": "GET",
        "endpoints": [{
            "method": "GET",
            "path": "/api/v2/ms/terrai-alerts/admin/:iso_code/:admin_id/:dist_id"
        }]
    }]
}

'''

About

Microservice for on the fly analysis and download of Terra I forest change data

Resources

Stars

Watchers

Forks

Packages

No packages published