Collections
These functions operate on an array or FeatureCollection.
clip
Given a FeatureCollection (or an array of Features) and a mask geometry, return a new collection where the Feature geometries include only regions within the mask:
$feature_collection | clip($mask)
clip($mask) is equivalent to:
map(.geometry = ([.geometry, $mask] | intersection))
erase
Given a FeatureCollection (or an array of Features) and a mask, return a new collection where the Feature geometries include only regions outside of the mask.
$feature_collection | erase($mask)
erase($mask) is equivalent to:
map(.geometry = ([.geometry, $mask] | difference))
feature_collection
Wrap an array of Features in a FeatureCollection.
filter
Based on a predicate, filter down an array:
filter(. >= 2)
or a FeatureCollection:
filter(.properties.state == "PA")
returning the same collection type.
find
Like filter, but return only the first item in the array or Feature in the FeatureCollection.
This is equivalent to:
filter(<predicate>) | .[0]
map
Apply an expression to each item in an array:
map(. + 1)
or Feature in a FeatureCollection:
map(.geometry | buffer(5))
returning the same collection type.
merge
Like union, but with a predicate to use for filtering:
merge(.properties.COUNTY == "46")
This is equivalent to:
filter(<predicate>) | union
sort
Sort an array or a FeatureCollection based on the sort rules of
jq.