Published FTW Polygons¶
Data-access helpers for the published Fields of The World polygons. See FTW polygon query.
ftw_query ¶
Query the published Fields of The World (FTW) Global prediction polygons.
Data-access helpers for already-published FTW polygons (PRUE model
predictions on Source Cooperative, CC-BY-4.0; see :mod:agribound.ftw_arrow
for the layouts and the confidence column). The module does not run FTW
inference, host FTW data, or treat FTW predictions as ground truth.
Two backends:
"pyarrow": the public GeoParquet on Source Cooperative (default layoutby-admin-conf), or any GeoParquet file, directory or glob given assource_url."manifest": local or HTTP(S) GeoParquet tiles listed in a manifest, or a local tile directory.
query_ftw ¶
query_ftw(study_area: Any, year: int | str | None = None, label: str | None = 'field', clip: bool = True, output_path: str | Path | None = None, output_format: str | None = None, source_url: str | None = None, manifest_path: str | Path | None = None, tile_dir: str | Path | None = None, cache_dir: str | Path | None = None, source_backend: str = 'auto', max_features: int | None = None, columns: list[str] | tuple[str, ...] | None = None, deduplicate: bool = True, dst_crs: str | int | None = None, min_confidence: float | None = None, keep_null_confidence: bool = True, layout: str = DEFAULT_FTW_LAYOUT, provenance: bool = True) -> gpd.GeoDataFrame
Query published FTW polygons for a study area.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
study_area
|
object
|
AOI as a GeoJSON/GPKG/Shapefile/GeoParquet path, |
required |
year
|
int, str, or None
|
Optional prediction-year filter, applied to |
None
|
label
|
str or None
|
Optional label filter. Defaults to |
'field'
|
clip
|
bool
|
If |
True
|
output_path
|
str, Path, or None
|
Optional destination path. Supported formats are those accepted by
:func: |
None
|
output_format
|
str or None
|
Optional output format override. |
None
|
source_url
|
str or None
|
PyArrow backend: GeoParquet file, directory, S3 prefix or glob (default:
the prefix of layout; |
None
|
manifest_path
|
str, Path, or None
|
Path or HTTP/HTTPS URL to a local tile manifest. The manifest may be a vector file with tile geometries or a tabular file with tile paths and bbox columns. |
None
|
tile_dir
|
str, Path, or None
|
Directory containing local GeoParquet tiles. Used to resolve relative paths in a manifest. If no manifest is provided, a manifest is built from tile-level GeoParquet metadata in this directory. |
None
|
cache_dir
|
str, Path, or None
|
Directory for downloaded remote manifests or candidate tiles, and for
the cached partition-bounding-box index of the PyArrow backend
(default |
None
|
source_backend
|
str
|
Source backend: |
'auto'
|
max_features
|
int or None
|
Optional row limit for PyArrow-backed preview or smoke-test queries. |
None
|
columns
|
list[str], tuple[str, ...], or None
|
Optional tile columns to read and return. Internal filter and deduplication columns are read when needed but dropped from the result unless explicitly requested. |
None
|
deduplicate
|
bool
|
Drop repeated polygons, such as the same polygon read from two
overlapping tiles. Rows are duplicates when their normalized geometry
is identical (SHA-1 of the normalized WKB) and, whenever the
prediction year can be read, so is the year, so the same polygon
predicted in 2024 and 2025 is kept once per year. The first row is
kept; rows with a missing or empty geometry are always kept. The
published |
True
|
dst_crs
|
str, int, or None
|
Optional CRS for the returned GeoDataFrame. |
None
|
min_confidence
|
float or None
|
Keep polygons with |
None
|
keep_null_confidence
|
bool
|
Keep polygons whose confidence is null (default True). A null
confidence means the 500 m confidence raster has no data at the
field's point-on-surface, not a low score. False drops them, with or
without min_confidence. Coverage is uneven: on 2026-09-27 the
confidence was null for 99.7 % of the rows of |
True
|
layout
|
str
|
Published layout used when source_url is None: |
DEFAULT_FTW_LAYOUT
|
provenance
|
bool
|
With output_path, also write |
True
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
Published FTW polygons intersecting the AOI. The |
Notes
This function is a query/download helper for existing FTW prediction polygons. It does not run FTW inference and should not be used to treat FTW predictions as ground truth.
Source code in agribound/ftw_query.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |
query_provenance_record ¶
query_provenance_record(parameters: dict[str, Any], query_info: dict[str, Any], aoi_4326: GeoDataFrame) -> dict[str, Any]
Provenance record written next to a :func:query_ftw output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
dict
|
The query arguments (the study area described, not embedded). |
required |
query_info
|
dict
|
|
required |
aoi_4326
|
GeoDataFrame
|
The study area in EPSG:4326 (its bounds are recorded). |
required |
Returns:
| Type | Description |
|---|---|
dict
|
JSON-serialisable record with |
Source code in agribound/ftw_query.py
ftw_arrow ¶
PyArrow backend for the published Fields of The World (FTW) Global polygons.
The polygons are predictions of the PRUE model published on Source
Cooperative (source.coop/ftw/global-data, CC-BY-4.0). This module reads
them; it does not run FTW inference, and the polygons are model output, not
ground truth.
Layouts
"by-admin-conf" (default; :data:FTW_VECTOR_LAYOUTS)
predictions/vectors/alpha/results-by-admin-conf/admin:country_code=<CC>/
<name>.parquet: fiboa/vecorel GeoParquet partitioned by country (large
countries by subdivision), with columns id, geometry, bbox,
metrics:area, metrics:perimeter, determination:datetime
(timestamp, UTC; 1 January of the prediction year), determination:method,
admin:country_code, admin:subdivision_code and confidence.
Years 2024 and 2025 are published (collection temporal extent
2024-01-01 to 2025-12-31, checked 2026-09-26).
"raw"
The older predictions/vectors/alpha/results Spark output (1000 parts)
with geometry, time, label (field, non_field_background,
field_boundaries) and bbox columns and no confidence.
Only the files whose data bounding box intersects the study area are opened
(partitioning=None). The bounding box of a file comes from the Parquet
row-group statistics of its bbox columns, read from the file footer; the
GeoParquet geo metadata bbox is used only when those statistics are
missing, because the published geo bboxes of subdivided countries are
wrong (see :func:footer_bbox). For remote sources the boxes are read once
and cached in a small JSON index, keyed by each file's path, size and
modification time, under index_cache_dir (default
$XDG_CACHE_HOME/agribound/ftw or ~/.cache/agribound/ftw). The
per-partition STAC items reachable from predictions/vectors/collection.json
carry correct bboxes (checked for Australia on 2026-09-27), but they need one
request per partition plus one per country sub-catalog, so they are not
faster than the footers and are not used.
Confidence
confidence is on a 0-100 scale: the 500 m PRUE confidence raster sampled
at each field's point-on-surface and rescaled raw / 0.578178 * 100
(clamped to 100). The dataset README recommends confidence >= 69 (raw
0.4) as the default reliability filter (:data:RECOMMENDED_MIN_CONFIDENCE).
Null means that the confidence raster has no data in the cell of the field's
point-on-surface ("Cells with no data become null"), not a low score, so null
values are kept unless keep_null_confidence=False.
Confidence describes 500 m cell-level model reliability, not the geometric
accuracy of individual polygons. Source: predictions/vectors/README.md and
collection.json of the dataset (read 2026-09-26).
FTW_VECTOR_LAYOUTS
module-attribute
¶
FTW_VECTOR_LAYOUTS: dict[str, str] = {'by-admin-conf': FTW_GLOBAL_DATA_S3 + 'predictions/vectors/alpha/results-by-admin-conf/', 'raw': FTW_GLOBAL_DATA_S3 + 'predictions/vectors/alpha/results/'}
Published polygon layouts (see the module docstring).
PUBLISHED_YEARS
module-attribute
¶
Prediction years in the published by-admin-conf layout (as of 2026-09-26).
RECOMMENDED_MIN_CONFIDENCE
module-attribute
¶
Reliability filter recommended by the dataset README (confidence >= 69, raw 0.4).
query_ftw_arrow ¶
query_ftw_arrow(study_area_bounds: tuple[float, float, float, float] | list[float], source_url: str | Path | None = None, year: int | str | None = None, label: str | None = 'field', columns: list[str] | tuple[str, ...] | None = None, max_features: int | None = None, *, min_confidence: float | None = None, keep_null_confidence: bool = True, layout: str = DEFAULT_FTW_LAYOUT, index_cache_dir: str | Path | None = None) -> gpd.GeoDataFrame
Query published FTW polygons that intersect a bounding box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
study_area_bounds
|
tuple
|
|
required |
source_url
|
(str, Path or None)
|
GeoParquet file, directory, S3 prefix or glob (e.g.
|
None
|
year
|
(int, str or None)
|
Prediction year, matched against |
None
|
label
|
str or None
|
Keep rows with this |
'field'
|
columns
|
list or None
|
Extra columns to read (all default columns present are read anyway). |
None
|
max_features
|
int or None
|
Stop after this many rows (preview queries). |
None
|
min_confidence
|
float or None
|
Keep rows with |
None
|
keep_null_confidence
|
bool
|
Keep rows whose confidence is null (default True). False drops them, also when min_confidence is None. |
True
|
layout
|
str
|
|
DEFAULT_FTW_LAYOUT
|
index_cache_dir
|
(str, Path or None)
|
Directory for the cached partition-bounding-box index. |
None
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
Rows in EPSG:4326. |
Raises:
| Type | Description |
|---|---|
ValueError
|
For an unknown layout, or a confidence filter on a source without a
|
Source code in agribound/ftw_arrow.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |