Giter VIP home page Giter VIP logo

mapbiomas-alert-api's Introduction

MapBiomas Alert Api

MapBiomas Alert Api is a python client for the MapBiomas Alert Api service.

MapBiomas Alert is a system that validates and refines deforestation alerts with high-resolution images. In one free and open access platform, the service gather all deforestation alerts in Brazil's territory and cross them with relevant information such as authorizations, embargoes, property's registry numbers, protected areas, indigenous lands, etc.

You can find information about the project here.

How to install

git clone https://github.com/Gui-Luz/mapbiomas-alert-api

How to use

Importing the package:
from src.map_biomas_api import MapBiomasAlertApi
Authenticating
credentials = {'email': 'your email',
               'password': 'your password'}
token = MapBiomasAlertApi.token(credentials)
Quering the service

After getting your bearer token you can use the api to query the service.

Currently, MapBiomas offers seven types of queries:

  • Published Alerts
  • Published Alert
  • Alert Report
  • Territories
  • Alerts From Car
  • Alert Actions
  • Territories of Interest

You can find the complete service documentation here.

To query the service, you should use the query function of the MapBiomasAlertApi object passing your token, the query and filters as arguments.

Example

In the example bellow we query published alerts by date

filters = {
  "startDetectedAt": "2020-01-01",
  "endDetectedAt": "2021-12-30",
  "startPublishedAt": "2020-01-01",
  "endPublishedAt": "2021-12-30",
  "offset": 0,
  "limit": 2
}
result = MapBiomasAlertApi.query(token,
                                 MapBiomasAlertApi.PUBLISHED_ALERTS_QUERY,
                                 filters)

In the example bellow we query published alert by alert code

filters = {
  "alertCode": "14691"
}
result = MapBiomasAlertApi.query(token,
                                 MapBiomasAlertApi.PUBLISHED_ALERT_QUERY,
                                 filters)

The result object of the query above should be a dictionary containing the information about the deforastion alert

{
  "data": {
    "publishedAlert": {
      "alertCode": "14691",
      "areaHa": 1.2429,
      "sources": [
        "DETERB-AMAZONIA"
      ],
      "bbox": [
        -56.3378933695091,
        -6.0042908703269475,
        -56.320931339719536,
        -5.9873288405373835
      ],
      "alertBiomes": [
        "AMAZÔNIA"
      ],
      "alertCities": [
        "ITAITUBA"
      ],
      "alertStates": [
        "PARÁ"
      ],
      "detectedAt": "2019-06-04",
      "publishedAt": "2020-02-11",
      "deforestationClass": null
    }
  }
}

mapbiomas-alert-api's People

Contributors

gui-luz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.