Mo.Re.Farming
a MOnitoring and REmote system for a more sustainable farming
Mo.Re.Farming

Open Data in Mo.Re.Farming

The vast majority of the data collected and processed in the Mo.Re.Farming project is freely accessible through a set of public RESTful APIs.

Please read below to discover how these APIs can be used. Full documentation will be published soon.

API - Data Lake

Link: http://semantic.csr.unibo.it/morefarming/api/data-lake

This layer of APIs exposes the contents of the Data Lake, lying in an 11-node Hadoop cluster. Use this API to download the following contents.

  • Satellite images from ESA's Sentinel-2 satellites in three formats:
    • L-1C: images containing top-of-atmosphere reflectances, directly obtained through ESA's public API service;
    • L-2A: images containing bottom-of-atmosphere reflectances, processed with the GDAL library;
    • GeoTIFF: images obtained by 1) merging every L-2A image available on a given date, 2) tiling the whole result, and 3) transforming it into a pyramid of multi-resolution levels.
  • Smart trap images collected daily from on-the-field sensors.
  • Administrative borders obtained from ISTAT's website.
  • Meteo data obtained through ARPAE's public API service.

Unfortunately, due to license regulation, rural land and crop data are not available for download at this time.

API - ODS

Link: http://semantic.csr.unibo.it/morefarming/api/ods

This layer of APIs is linked to the Operational Data Store (ODS) of the Mo.Re.Farming platform, which lies on a PostGIS DBMS. These APIs let you gather punctual information on a specific geo-referenced point in the Emilia-Romagna region, comprising values for the following indexes: NDVI, NDRE, NDWI, and MTCI (i.e., the information that is shown by the dashboard).

Usage of these APIs is fairly straightforward. Just issue a GET request to the provided link stating the following parameters:

  • latitude: the latitude of a point in EPSG:32632;
  • longitude: the longitude of a point in EPSG:32632;
  • date: a date in format YYYY-MM-DD.

Example: http://semantic.csr.unibo.it/morefarming/api/ods?latitude=4910820&longitude=753335&date=2016-08-17

API - Spatial Cube

Link: http://semantic.csr.unibo.it/morefarming/api/ods

This layer of APIs is linked to the Spatial Cube of the Mo.Re.Farming platform, which lies on a PostGIS DBMS. The Saiku interface has already been deployed in order to expose the cube to OLAP queries. Since Saiku already comes with its own set of APIs, we can reuse them to execute OLAP queries on the spatial cube in a RESTful way.

Saiku API docs: https://community.meteorite.bi/docs/#home

Access point: http://semantic.csr.unibo.it:8082/saiku/rest/saiku/morefarming

Examples:

Queries must be written in the MDX language, which requires you to know the names of dimensions and measures in the cube (see GET requests above). An example of MDX query on the Mo.Re.Farming cube is the following:

WITH
    SET [~FILTER] AS
        {[Crop].[Crop].[IRRIGUO].[POMODORO]}
    SET [~COLUMNS] AS
        {[Date].[Date (by month)].[Month].Members}
    SET [~ROWS] AS
        {[Rural land].[Rural land].[Province].Members}
SELECT
    NON EMPTY CrossJoin([~COLUMNS], {[Measures].[NDVI (avg)]}) ON COLUMNS,
    NON EMPTY [~ROWS] ON ROWS
FROM [Indices]
WHERE [~FILTER]
							

This returns the average NDVI for fields of tomato in every province and in every month. The complete POST request (which must be preceeded by authentication via POST) would require the following parameters:

  • cube:
    • connection: 'MoReFarming',
    • catalog: 'MoReFarming',
    • schema: 'MoReFarming',
    • name: 'Indices'
  • mdx: 'WITH SET [~FILTER] AS {[Crop].[Crop].[IRRIGUO].[POMODORO]} SET [~COLUMNS] AS {[Date].[Date (by month)].[Month].Members} SET [~ROWS] AS {[Rural land].[Rural land].[Province].Members} SELECT NON EMPTY CrossJoin([~COLUMNS], {[Measures].[NDVI (avg)]}) ON COLUMNS, NON EMPTY [~ROWS] ON ROWS FROM [Indices] WHERE [~FILTER]',
  • name: 'myMdxQuery',
  • queryType: 'OLAP',
  • type: 'MDX'