CROPWISE SERVICES
Working with Fields πΎ
Overview
Fields are digital representations of your farming areas within the Cropwise platform, combining geographic data and seasonal context. Fields are essential for precise agricultural management, enabling you to store information and gain valuable insights about smaller, delimited portions of land throughout your farming operation.
Field Hierarchy
Workspace
βββ Organization
βββ Property
βββ Field β You are here
API Documentation
For complete API reference including request/response schemas, authentication, and interactive testing, visit:
π Fields API Documentation - Interactive API documentation with request/response examples
Available Endpoints
POST /v2/fields
- Create a new fieldGET /v2/fields/{id}
- Get field by IDPUT /v2/fields/{id}
- Update field informationDELETE /v2/fields/{id}
- Delete a fieldGET /v2/properties/{property_id}/fields
- List fields by property
Field Attributes
Core Attributes
Attribute | Type | Required | Description |
---|---|---|---|
name | string | Yes | Field name (max 255 characters) |
property_id | UUID | Yes | Parent property identifier |
declared_area | number | Yes | Field area in hectares (β₯ 0) |
parent_region_id | UUID | No | Region identifier (defaults to property root) |
geometry | GeoJSON | No | Field boundary (Polygon/MultiPolygon) |
reference_point | GeoJSON | No | Reference point (Point) |
event_date | string | No | Event date (yyyy-MM-dd) |
valid_since | string | No | Validity start date |
valid_until | string | No | Validity end date |
Read-only Attributes
Attribute | Type | Description |
---|---|---|
id | UUID | Unique field identifier |
calculated_area | number | System-calculated area from geometry |
created_at | datetime | Creation timestamp |
updated_at | datetime | Last update timestamp |
deleted | boolean | Soft deletion status |
Best Practices
Field Creation
- Ensure
property_id
exists before creating fields - Use descriptive and consistent field names
- Provide accurate
declared_area
in hectares - Set appropriate validity periods using
event_date
Geometry Management
- Use valid GeoJSON Polygon format for field boundaries
- Ensure coordinates are in [longitude, latitude] format
- Close polygon boundaries (first and last coordinates must match)
- Use precise GPS coordinates for accuracy
- Include reference points for better field identification
- Coordinates should have 6 decimal places for optimal precision (10β»βΆ degrees β 0.11 meters at the equator)
Data Organization
- Apply consistent naming conventions (e.g., "Field 1A", "Field 1B")
- Keep field data updated when conditions change
- Monitor calculated vs declared area discrepancies
Performance Optimization
- Cache field data locally when possible
- Use reference_date parameter for historical queries
- Keep geometry complexity reasonable for performance, use the minimum coordinates as possible
Field Creation Rules & Limitations
Business Logic & Constraints
Name Uniqueness
name
must be unique within the sameparent_region_id
(case-insensitive)name
cannot be null, blank, or exceed 255 characters
Area Constraints
declared_area
must be greater than or equal to 0- The sum of all field areas may be limited by licensing or contract quotas
Region & Property
parent_region_id
must refer to an existing, non-deleted region- The region must belong to the same
property_id
as the field - The region must be a leaf region (cannot have sub-regions)
Geometry Constraints
- If
geometry
is provided, it must be a valid Polygon or MultiPolygon (GeoJSON) - Geometry coordinates must be within allowed ranges (longitude β€ 180, latitude β€ 90)
- Geometry must not self-intersect
- Geometry must not overlap with other fields in the same period and Property
- If
geometry
is omitted, the region must still be a leaf andname
must be unique
Date Constraints
event_date
must be in valid yyyy-MM-dd formatevent_date
cannot be greater than 2038-01-19 (system limitation)valid_until
cannot be beforevalid_since
Quota & Licensing
- If the workspace has limited field creation enabled, the total area of fields must not exceed the allowed quota for the contract or plan
Error Codes
Field Errors (Business/DTO)
Code | Message | HTTP Status | When Triggered |
---|---|---|---|
EFLD001 | Invalid size | 400 BAD REQUEST | declared_area < 0 |
EFLD002 | Field name already exists for this region | 400 BAD REQUEST | name not unique in region |
EFLD003 | Field does not exist | 404 NOT FOUND | Field not found |
EFLD004 | Region does not exist | 404 NOT FOUND | Region not found |
EFLD006 | Field name should be less than 256 characters | 400 BAD REQUEST | name too long |
EFLD010 | Region parent id cannot be null | 400 BAD REQUEST | parent_region_id is null |
EFLD014 | Field already exists | 409 CONFLICT | Field with same ID and event_date exists |
EFLD015 | Field name cannot be null | 400 BAD REQUEST | name is null |
EFLD018 | Region's and field's should be on the same property | 400 BAD REQUEST | Region and field property mismatch |
EFLD021 | The field has an active link to a season | 400 BAD REQUEST | Field is linked to an active season |
EFLD022 | User has exceeded the limit of field creation | 400 BAD REQUEST | Area quota exceeded |
EFLD024 | Field valid_until cannot be before valid_since | 400 BAD REQUEST | Validity period error |
Geometry Errors (Geometry/Spatial)
Code | Message | HTTP Status | When Triggered |
---|---|---|---|
EGEO002 | Cannot update field! It does not exist | 404 NOT FOUND | Update on non-existent field |
EGEO003 | Cannot create field. It already exists | 400 BAD REQUEST | Field already exists |
EGEO004 | Field geometry is invalid or intersects with itself | 400 BAD REQUEST | Invalid/self-intersecting geometry |
EGEO005 | Geometry intersection found | 400 BAD REQUEST | Overlapping geometry |
EGEO008 | Declared area cannot be negative | 400 BAD REQUEST | declared_area < 0 |
EGEO010 | Specified region either doesn't exist, not in property, or not a leaf | 400 BAD REQUEST | Invalid region for field |
EGEO011 | Invalid date format | 400 BAD REQUEST | event_date format invalid |
EGEO012 | Date is not valid. The date cannot be greater than 2038-01-19 | 400 BAD REQUEST | event_date out of range |
EGEO022 | The dimensions of the geometries exceed the maximum allowable limits | 400 BAD REQUEST | Geometry coordinates out of bounds |
Common Error Categories
Category | Description | Example Codes |
---|---|---|
Field Validation | Errors related to invalid field data | EFLD001, EFLD002, EFLD006, EFLD015 |
Resource Not Found | Resource does not exist | EFLD003, EFLD004, EGEO002 |
Geometry Validation | Errors related to invalid geometries | EGEO004, EGEO005, EGEO022 |
Date Validation | Errors related to invalid dates | EGEO011, EGEO012, EFLD024 |
Conflict | Resource already exists or conflicts | EFLD014, EGEO003 |
Quota | Exceeded usage limits | EFLD022 |
Common Use Cases
For complete implementation examples including API calls, authentication, and error handling, visit our interactive API documentation:
π Fields API Examples β - Interactive examples with code samples
Typical Workflows
Basic Field Management
- Create Field - Set up new cultivation areas with boundaries and metadata
- Update Field - Modify field properties like area, name, or geometry
- Retrieve Field - Get field details for analysis or display
- List Fields - Query fields by property or organization
Working with Geometry
- Field Boundaries - Define precise field boundaries using GeoJSON Polygon format
- Reference Points - Set center points for field identification and mapping
- Coordinate Systems - Use WGS84 datum with [longitude, latitude] format
- Area Calculation - Compare declared vs calculated areas for validation
Temporal Field Management
- Seasonal Fields - Create fields with specific validity periods
- Historical Queries - Retrieve field data as of specific dates
- Field Evolution - Track changes to field boundaries over time
- Event Dating - Associate field changes with specific agricultural events
Next Steps
After creating your fields, you can: