Skip to content

Filter by custom fields

Filter datapoints server-side with queryable custom dataset fields.

Queryable fields let you filter datapoints by custom metadata before Tilebox returns the query result. You can combine custom field expressions with temporal, spatial, and collection filters in the same query.

The dataset schema identifies which fields are queryable. Inspect the schema to find fields available for filtering.

Terminal window
tilebox dataset get open_data.aws_earth.sentinel2

The open_data.aws_earth.sentinel2 dataset exposes these queryable fields:

FieldType
stac_idstring
platformstring
cloud_coverfloat64
nodata_pixel_percentagefloat64

This query returns Sentinel-2C Level-2A datapoints with less than one percent cloud cover between July 20 and July 28, 2026.

from tilebox.datasets import Client, field
client = Client()
dataset = client.dataset("open_data.aws_earth.sentinel2")
data = dataset.query(
collections=["L2A"],
temporal_extent=("2026-07-20", "2026-07-28"),
filter=(field("cloud_cover") < 1) & (field("platform") == "sentinel-2c"),
)

Tilebox combines custom field expressions with temporal, spatial, and collection filters using AND.

Custom field filters support comparisons, boolean composition, and null checks.

OperationSyntax
Equalfield("x") == value
Not equalfield("x") != value
Less thanfield("x") < value
Less than or equalfield("x") <= value
Greater thanfield("x") > value
Greater than or equalfield("x") >= value
ANDleft & right
ORleft | right
NOT~expression
Is nullfield("x").is_null()
Is not nullfield("x").is_not_null()

Use &, |, and ~ instead of and, or, and not, and place each comparison in parentheses.

Fields of type bool support only equality and inequality.

Filter expressions use three-valued logic: true, false, and null (unknown). A datapoint matches only when the complete expression is true. Comparisons against a missing or explicitly null field return null and do not match.

This behavior also applies to inequality. For example, quality != 1 requires quality to be present. Combine the comparison with an explicit null check when missing values should also match.

filter = (field("quality") != 1) | field("quality").is_null()

A single query can contain filters with at most 64 top-level expressions or operands, 256 expression nodes in total, and eight levels of nesting. These safeguards keep query evaluation bounded.