Skip to main content

fetchRvoFields

@nmi-agro/fdm-source


@nmi-agro/fdm-source / fdm-rvo/src / fetchRvoFields

Function: fetchRvoFields()

fetchRvoFields(rvoClient, year, kvkNumber): Promise<infer<any>[]>

Defined in: fdm-rvo/src/data.ts:25

Fetches agricultural fields (bedrijfspercelen) from the RVO webservice for a specific year and farm.

This function retrieves the fields in GeoJSON format and validates them against the RvoFieldSchema.

Parameters

rvoClient

RvoClient

An authenticated instance of RvoClient (must have a valid access token).

year

string

The calendar year for which to retrieve the fields (e.g., 2024).

kvkNumber

string

The Chamber of Commerce (KvK) number of the farm/organization. This acts as the identifier for the data request.

Returns

Promise<infer<any>[]>

A promise that resolves to an array of validated RvoField objects.

Throws

Will throw a ZodError if the response from RVO does not match the expected schema.

Throws

Will throw an error if the API request fails.