Registry / storage / winnow

winnow

JSON →
library2.6.0jsnpmunverified

Apply SQL-like filters to GeoJSON feature collections in memory or via streams. v2.6.0 is the last standalone release; development has moved to @koopjs/winnow in the Koop monorepo. Supports WHERE clauses, spatial predicates (ST_Within, ST_Contains, ST_Intersects), field selection, aggregations (sum, avg, count, max, min, first, last), group by, limit/offset, ordering, CRS reprojection, and Esri feature output. Ships TypeScript types.

npm install winnow
INSTALL
IMPORT
SIG · WINNOW
W
winnow
storagejavascriptv2.6.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (winnow)
import winnow from 'winnow'
const winnow = require('winnow')
Package is ESM-only; CommonJS require() will fail. Use dynamic import or switch to @koopjs/winnow.
query
import { query } from 'winnow'
import { query } from 'winnow/query'
query is a named export, not a subpath export.
TypeQueryOptions
import type { QueryOptions } from 'winnow'
const QueryOptions = require('winnow').QueryOptions
TypeScript types are included, but QueryOptions is a type, not a runtime value.

Queries a GeoJSON FeatureCollection with a WHERE clause, field selection, and ordering, printing the filtered result.

import winnow from 'winnow'; const features = { type: 'FeatureCollection', features: [ { type: 'Feature', properties: { name: 'a', value: 1 }, geometry: { type: 'Point', coordinates: [-118, 34] } }, { type: 'Feature', properties: { name: 'b', value: 2 }, geometry: { type: 'Point', coordinates: [-119, 35] } }, { type: 'Feature', properties: { name: 'c', value: 3 }, geometry: { type: 'Point', coordinates: [-120, 36] } } ] }; const result = await winnow.query(features, { where: "value > 1", fields: ['name'], order: ['name DESC'] }); console.log(result); // { type: 'FeatureCollection', features: [ { type: 'Feature', properties: { name: 'b' }, geometry: { type: 'Point', coordinates: [-119, 35] } }, { type: 'Feature', properties: { name: 'c' }, geometry: { type: 'Point', coordinates: [-120, 36] } } ] }
Debug
Known issues
deprecatedwinnow is deprecated; use @koopjs/winnow from the Koop monorepo instead.
fix
npm uninstall winnow && npm install @koopjs/winnow and update imports to '@koopjs/winnow'.
affects: >=2.0.0
breakingv2.0.0 changed the API from constructor-based to static methods. 'new Winnow()' no longer works.
fix
Use winnow.query(data, options) instead of instantiating Winnow.
affects: >=2.0.0
gotchaThe package is ESM-only; require() throws 'ERR_MODULE_NOT_FOUND' or similar.
fix
Use import or dynamic import(). For CommonJS projects, consider @koopjs/winnow which supports CJS.
affects: >=2.0.0
gotchaThe 'projection' option was renamed to 'outputCrs' in v2.0.0. Using 'projection' is silently ignored.
fix
Use 'outputCrs' instead of 'projection'.
affects: >=2.0.0
deprecatedThe 'toEsri' option will be removed in a future version.
fix
Use @terraformer/arcgis or esri-to-geojson packages for conversion.
affects: >=2.6.0
Errors
Common errors & fixes
ERR_MODULE_NOT_FOUND: Cannot find module 'C:\path\to\node_modules\winnow\dist\node\index.js' imported from ...
Trying to require() an ESM-only package in a CommonJS context.
fix
Use 'import winnow from "winnow"' or switch to @koopjs/winnow.
TypeError: winnow.query is not a function
Using default import incorrectly, or trying to call a method on a namespace that is a class instance.
fix
Ensure correct import: `import winnow from 'winnow'`. Also check that winnow.query exists (v2+).
Error: Invalid spatial predicate: esriSpatialRelTouches
Only ST_Within, ST_Contains, ST_Intersects (and Esri equivalents) are supported.
fix
Use one of the supported spatial predicates: ST_Within, ST_Contains, ST_Intersects, esriSpatialRelWithin, esriSpatialRelContains, esriSpatialRelIntersects.
Error: Unknown aggregate type: 'median'
Only sum, avg, count, max, min, first, last are supported.
fix
Use only supported aggregate types: 'sum', 'avg', 'count', 'max', 'min', 'first', 'last'.
Upgrade
Version history
2.6.0latest on npm
Audit
Dependencies
@terraformer/arcgisrequiredConverts between GeoJSON and Esri geometry
@terraformer/spatialrequiredSpatial predicate operations
topojson-clientoptionalTopoJSON support
Agent activity
33 hits · last 30 days
node
30
OpenAI (training)
1
Resources
packagewinnow
winnow — npm install winnow · libregistry