Inside ANY ring (multi-polygon union).
Fast-reject window in pixel space (union across rings), mirroring
ui/rasterTools.js polygonPixelBbox.
StaticallStaticfromCoerce any friendly input into a Filter.
Filter-like → returned as-is (anything with a test(unit) method)
function → PredicateFilter
Region-like → input.toFilter()
polygon → SpatialFilter ([[lat,lng],…] | [{lat,lng},…] | [[ring],[ring]…])
DUCK-TYPED, not instanceof Filter, for the same reason nothing in the engine does
instanceof Dataset: class identity is per-module-instance, and fimviz and fimviz/ui are
two separate bundles that each carry their own copy of this file. A SpatialFilter built by
fimviz/ui's createRegionDraw is therefore NOT instanceof the engine bundle's Filter, so
layer.getStats({ filter }) rejected the tool's own output. Testing for the method — the only
thing every call site actually uses — makes the seam work across bundles and lets a host pass
its own filter object.
[{lat,lng}|[lat,lng]…] for one ring, or [[ring],[ring]…] for many.