Downloading GeoJSON Features of a Dataset
The following request downloads GeoJSON features (rows) of geometry datasets or analyses created in a database data source (connection).
HTTP GET Request
curl -k --get \
"${BASE_URL}/oauth/v1/jsonstream/${DATASET_ID}" \
--header "Authorization: Bearer ${TOKEN}" \
--output result.json
The preceding curl command uses a valid dataset streaming access token to request and save the GeoJSON features for the specified dataset. Set the BASE_URL variable to https://localhost:4040/spatialstudio.
You can also filter the result by appending a filter payload to the request. For instance, if you only need one feature with a given key value, then you can append a filter as follows:
Request with Filter:
curl -k --get \
"${BASE_URL}/oauth/v1/jsonstream/${DATASET_ID}" \
--header "Authorization: Bearer ${TOKEN}" \
--data-urlencode 'filter={"f":"LIST","c":"RECORD_ID","v":[16013340379]}' \
--output result.json
In the preceding example, set the BASE_URL variable to https://localhost:4040/spatialstudio. The filter in the example restricts the result to contain only a feature whose key column RECORD_ID has a value of 16013340379.
For more details on how to construct a data filter for Spatial Studio, see Understanding Data Filters.
Understanding Data Filters
The following describes the server-side filter syntax used by database-backed dataset streaming endpoints, including GET /api/v1/jsonstream/{datasetId}. Filtering allows you to add a custom data filter so the resulting GeoJSON contains only features satisfying the filter. When a filter query parameter is not supplied, all features from the dataset are returned.
Supply filter as a URL-encoded JSON object. Spatial Studio applies the condition to the dataset query before returning results.
A filter typically contains three JSON properties, listed in the following table with their corresponding meanings.
| Property | Meaning |
|---|---|
f |
Filter type, such as LIST, COMPARISON, or COMPOUND. |
c |
Dataset column name. Use the column name exposed by the dataset, including analysis output columns. |
v |
Value, array of values, or array of child filters, depending on f. |
Use JSON strings for text values and JSON numbers for numeric values. Filter type names are not case-sensitive; the following examples use uppercase consistently.
| Filter Type | Description | Example |
|---|---|---|
LIST |
Matches any listed value. A single value is an equality check. | {"f":"LIST","c":"RECORD_ID","v":[1601220379, 1542001567]} |
COMPARISON |
Compares a column with a typed value. | {"f":"COMPARISON","c":"POPULATION","cop":"GTE","vt":"NUMERIC","v":10000} |
LIKE |
Matches a SQL LIKE pattern. % matches any sequence of characters; _ matches one character. |
{"f":"LIKE","c":"NAME","v":"San%"} |
RANGE |
Matches values strictly greater than sv and strictly less than ev in the current implementation. |
{"f":"RANGE","c":"POPULATION","sv":10000,"ev":50000} |
COMPOUND |
Combines conditions using AND or OR. |
See Compound filters. |
ST_RANGE |
Matches timestamps within an inclusive time interval. | See Temporal filters. |
LAST_N_INTERVALS |
Matches timestamps later than a cutoff calculated relative to the current time. | See Relative-time filter. |
BBOX |
Applies a spatial bounding-box filter where supported. Coordinates are [xmin,ymin,xmax,ymax]; s is the coordinate-system SRID, defaulting to 4326. |
{"f":"BBOX","c":"GEOM","s":4326,"v":[-123,37,-121,39]} |
For COMPARISON, specify cop and vt:
cop |
Comparison |
|---|---|
EQ |
Equal to |
NEQ |
Not equal to |
GT |
Greater than |
GTE |
Greater than or equal to |
LT |
Less than |
LTE |
Less than or equal to |
Use vt:"STRING" for text or vt:"NUMERIC" for numbers. For example:
{"f":"COMPARISON","c":"STATUS","cop":"NEQ","vt":"STRING","v":"CLOSED"}
Compound filters
A compound filter combines multiple simple filter expressions using op:"AND" or op:"OR" and places its child filters in v. Groups may be nested; each group can contain up to 10 child filters.
For example, the following filter selects active records with a population between 10,000 and 50,000, including both bounds:
{
"f": "COMPOUND",
"op": "AND",
"v": [
{"f":"LIST","c":"STATUS","v":["ACTIVE"]},
{"f":"COMPARISON","c":"POPULATION","cop":"GTE","vt":"NUMERIC","v":10000},
{"f":"COMPARISON","c":"POPULATION","cop":"LTE","vt":"NUMERIC","v":50000}
]
}
Temporal filters
For temporal filtering, use a timestamp column with the appropriate stored timezone convention. The following ST_RANGE example includes both endpoints. Supply UTC timestamps in the illustrated format:
{
"f": "ST_RANGE",
"c": "OBSERVED_AT",
"t1": "2026-10-09T12:00:00.000Z",
"t2": "2026-10-09T13:00:00.000Z",
"t": "UTC"
}
Relative-time filter
The following relative-time filter selects timestamps later than the current time minus 300 seconds:
{
"f": "LAST_N_INTERVALS",
"c": "OBSERVED_AT",
"v": 300,
"u": "SECOND",
"t": "UTC"
}
v must be a positive integer. Use SECOND, MINUTE, HOUR, or DAY for timestamp-column requests. t:"UTC" selects a UTC cutoff; omitting it uses the database timestamp expression without UTC extraction.
This filter supplies a lower bound only, so future timestamps can also match. For a configured temporal column stored as epoch milliseconds, Spatial Studio converts the temporal bounds to that numeric representation.
Use curl --data-urlencode to encode the JSON correctly, including % characters in LIKE patterns:
curl --fail-with-body --silent --show-error --get \
"${BASE_URL}/oauth/v1/jsonstream/${DATASET_ID}" \
--header "Authorization: Bearer ${TOKEN}" \
--data-urlencode 'filter={"f":"LIST","c":"RECORD_ID","v":["1601220379"]}'
Here, BASE_URL includes the application context, for example https://localhost:4040/spatialstudio. For session authentication, use /api/v1/jsonstream/{datasetId} with the session cookies. The GeoJSON endpoint also supports POST, with the filter object itself as the JSON request body.
Limitations when using filter
The following are known limitations when using filter:
-
Keep
LISTfilters to 200 values or fewer. -
Use
GTEandLTEcomparisons for inclusive numeric ranges;RANGEcurrently does not honor theisvandievinclusion flags. -
The streaming SQL conversion does not apply
neg:true. Use an explicit supported comparison such asNEQwhere appropriate. -
IS_NULL,NOT_NULL,DATE,SHAPE, andEXPRESSIONare not supported by this streaming filter path. -
BBOXrequires endpoint-specific spatial support. For GeoJSON streaming, it applies to the geometry selected by the endpoint, is not supported insideCOMPOUND, and uses a spatial candidate filter rather than an exact intersection test. -
Supply valid JSON and a supported filter type. Some malformed or unsupported filters are treated as absent rather than producing an error.