Module 3
Farm Mapping & Geospatial
Purpose#
Captures a verified GPS polygon or point for every farm — the primary EUDR geolocation requirement. A farmer can have multiple independently mapped farms, including multiple farms for the same commodity.
EUDR geolocation rules#
Regulatory requirement
These rules are not optional — they are a legal requirement under EUDR Article 9. Every farm must have a polygon or GPS centroid in WGS84 (EPSG:4326) before EUDR compliance can be assessed.
| Farm size | Required capture | Coordinate system |
|---|---|---|
| > 4 hectares | Full perimeter polygon (set of WGS84 coordinates) | WGS84 / EPSG:4326 |
| ≤ 4 hectares | GPS centroid (single point) — polygon preferred where possible | WGS84 / EPSG:4326 |
Area is calculated from the polygon using PostGIS:
sql
-- Area in hectares for the current farm polygon
SELECT ST_Area(ST_Transform(geometry, 3857)) / 10000 AS area_ha
FROM farm_geometries
WHERE farm_id = $1 AND is_current = true;Data model#
| Entity | Relationship | Key fields |
|---|---|---|
| Farm | Belongs to one farmer | Farm code, commodity, estimate, actual area, risk |
| Farm mapping | One current polygon or point per farm | WGS84 geometry and coordinate |
Polygon capture methods#
| Method | When to use |
|---|---|
| Mobile GPS walk-around | Officer walks the perimeter of the farm with the mobile app open. App records GPS coordinates every N seconds to form a polygon. |
| Web KML/GeoJSON upload | Upload a KML or GeoJSON file (e.g. exported from QGIS or Google Earth). |
| Manual coordinate entry | Enter polygon vertices by hand. Useful for small farms where a walk would be impractical. |
Satellite overlay#
The web map view overlays the captured polygon on satellite imagery for visual verification. This allows the officer or manager to confirm the polygon boundary looks correct before triggering a deforestation risk assessment.
Risk levels#
Each farm has a risk_level field populated by the Deforestation Risk Assessment module (Module 4):
| Level | Meaning |
|---|---|
| low | No deforestation detected on this farm since 31 December 2020. |
| medium | Minor vegetation change detected; below threshold for non-compliance. |
| high | Significant forest loss detected; requires remediation before EUDR compliance is possible. |
| critical | Confirmed deforestation. Farm is flagged non-compliant. Remediation required. |
| pending | Assessment requested but not yet returned from the provider. |
| unavailable | Provider could not assess this farm (e.g. missing polygon, cloud cover). |
Packages#
| Package | Type | Key exports |
|---|---|---|
@repo/feature-farm-mapping | Backend | Services: farm lifecycle, mapping, geospatial operations, export (GeoJSON) |
@repo/feature-farm-mapping-web | Frontend | Map component, farm list, farm form, coordinate editor |
Key Zod schemas#
CreateFarmSchemaUpdateFarmSchemaMapFarmSchemaGeoJsonPolygonSchemaGeoJsonPointSchemaFarmAttributesSchemaCaptureMethodSchema
Export formats
Farm data can be exported as GeoJSON (for EUDR Due Diligence Statements and GIS tools) or CSV. Export endpoints are on the API routes for the farm-mapping module.