Skip to content

Harmonizes farm subsidy application files from all German federal states

Notifications You must be signed in to change notification settings

fruchtfolge/harmonie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

harmonie 🌱

harmonie is a software package that harmonizes farm subsidy application files of all German federal states. It takes the various xml, gml, shp, and dbf files issued by the federal farm subsidy application softwares, and converts them into WGS84 projected GeoJSON geometries suitable for any web mapping service.

With harmonie, you can outsource parsing of the different direct payment application files, so you can rely on a given input data structure.

Demonstration of the ZID-Harmonie library

harmonie

  • ✅ works in the browser/Node.js
  • ✅ adheres to the agroJSON specification
  • ✅ is open source (MIT license)

Converting the geometries (fields) contained in the application files is supported for all federal states in Germany. For most federal states, additional information as the primary crop cultivated on a field, as well as the fieldblock number (FLIK) are obtained as well.

The following overview table displays the current state of the project:

✅ Federal states fully supported by 'harmonie': Plot geometries, including crop cultivation code and FLIK are obtained.
☑️ Federal states partially supported by 'harmonie': Only plot geometries are obtained.

Federal state ISO 3166-2 code Subsidy application program Test data available? Supported by 'harmonie' ToDos
Brandenburg DE-BB WebClient Agrarantrag BB -
Berlin DE-BE WebClient Agrarantrag BB -
Baden-Württemberg DE-BW FIONA - Flächeninformation und Online-Antrag -
Bayern DE-BY iBalis Bayern -
Bremen DE-HB ANDI - Agrarförderung Niedersachsen Digital ⬜️ ☑️ Waiting on test data (ANDI NDS)
Hessen DE-HE Antragsmappe der WI-Bank -
Hamburg DE-HH ANDI - Agrarförderung Niedersachsen Digital ⬜️ ☑️ Waiting on test data (ANDI NDS)
Mecklenburg-Vorpommern DE-MV WebClient Agrarantrag MV -
Niedersachsen DE-NI ANDI - Agrarförderung Niedersachsen Digital ⬜️ ☑️ Waiting on test data (ANDI NDS)
Nordrhein-Westfalen DE-NW ELAN-NRW WebClient -
Rheinland-Pfalz DE-RP eAntrag ☑️ Create property mapping
Schleswig-Holstein DE-SH WebClient Agrarantrag SH ⬜️ ☑️ Waiting on test data (ELSA Schleswig-Holstein)
Saarland DE-SL ASdigital Saarland -
Sachsen DE-SN DianaWeb WebClient SN ⬜️ ☑️ Waiting on test data (DIANAweb Sachsen)
Sachsen-Anhalt DE-ST ELAISA WebClient ST ⬜️ ☑️ Waiting on test data (ELAISA Sachsen-Anhalt)
Thüringen DE-TH Verona Thüringen -

Installation

Browser

<script src='https://cdn.jsdelivr.net/npm/[email protected]/dist/harmonie.min.js'></script>

Or grab a release from the relases tab. Loading the minified file via script tag exposes the global function harmonie.

Internet Explorer compatibility: Note that this package makes use of modern ES6 language features which are not compatible with Internet Explorer (also not by polyfilling). In order to support Internet Explorer directly, you may transpile the code (e.g. using @babel). Alternatively, you may use the plugin on the server side, or use our (upcoming) API.

Node.js / build tools

npm install zid-harmonie

The module exports a single function.

const harmonie = require('zid-harmonie')
// or using ES6 import
import harmonie from 'zid-harmonie'

Demonstration

Check out the following Observable notebook demonstrating the use of the library with a minimal user interface.

https://observablehq.com/@chrispahm/harmonizing-common-agricultural-policy-cap-farm-applicat

Usage

The function takes a single argument (object), returning a Promise.

const data = harmonie({
  state: 'DE-NW', // Required. The federal state (ISO 3166-2 code) that issued the ZID/IACS files
  xml: '<?xml version="1.0" encoding="UTF-8"?><nn>...</nn>', // The input data. Please see table below for required input data files for each federal state, and the required encoding.
  gml: '<?xml version="1.0" encoding="UTF-8"?><wfs>...</wfs>'  
}).then(data => {
  console.log(data)
  // data is an array of "part of field" (DE: 'Teilschläge') objects
}).catch(error => {
  // handle errors
})

API

harmonie(query)

Returns an array of objects containing individual parts of fields (German: Teilschläge). Properties adhere to the naming conventions defined by agroJSON

  • query <object>, required
    • state <string, ISO 3166-2> required
    • xml <string, UTF-8> may be required, depending on state
    • gml <string, UTF-8>
    • shp <blob>
    • dbf <blob>
    • prj <string, UTF-8> optional when passing shapefiles

Sample return value:

[{
  id: 'harmonie_runningIndex_FieldBlockNumber', // e.g. 'harmonie_36_DEBBLI0261009129'
  referenceDate: 2020,
  NameOfField: 'Hinterm Hof',
  NumberOfField: 0,
  Area: 1.1,
  FieldBlockNumber: 'DENW...',
  PartOfField: 0,
  SpatialData: {
    // a GeoJSON feature
  },
  Cultivation: {
    PrimaryCrop: {
      CropSpeciesCode: 415,
      Name: 'Wiesen'
    }
  }
}]

The following table displays the required properties for a query depending on the federal state:

Federal state ISO 3166-2 code Required query data
Brandenburg DE-BB state, xml
Berlin DE-BE state, xml
Baden-Württemberg DE-BW state, xml, shp, dbf
Bayern DE-BY state, xml
Bremen DE-HB state, shp, dbf
Hessen DE-HE state, shp, dbf
Hamburg DE-HH state, shp, dbf
Mecklenburg-Vorpommern DE-MV state, xml
Niedersachsen DE-NI state, shp, dbf
Nordrhein-Westfalen DE-NW state, xml, gml
Rheinland-Pfalz DE-RP state, shp, dbf
Schleswig-Holstein DE-SH state, shp, dbf
Saarland DE-SL state, shp, dbf
Sachsen DE-SN state, shp, dbf
Sachsen-Anhalt DE-ST state, shp, dbf
Thüringen DE-TH state, shp, dbf

Specifics for certain federal states

DE-HE: Hessen

According to the test data received from Hessen, the shape file and accompanying database does not contain information about the reference date of the files. Therefore, please expect the referenceDate to be undefined for this federal state.

DE-TH: Thüringen

According to the test data received from Thüringen, the shape file and accompanying database does not contain information about the crop cultivation for a particular field. Therefore, expect the Cultivation property to be empty.

Contribution

Contribution is highly appreciated 👍!
Please open an issue in case of questions / bug reports or a pull request if you implemented a new feature / bug fix.
In the latter case, please make sure to run npm test (and adapt test/test.js to your changes) and / or update the README 🙂

License

MIT @Christoph Pahmeyer

This software is crafted with ❤️ at the University of Bonn - EMAS Group

About

Harmonizes farm subsidy application files from all German federal states

Resources

Stars

Watchers

Forks

Packages

No packages published