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 on other Microservices:
For endpoint documentation, please visit our API documentation page for TerraI
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 API endpoints
./gladanalysis.sh test
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"
}]
}]
}
'''