Feature query and catalogue search

Tiles answer "draw this viewport". Feature query answers "which features match": server-side, returning GeoJSON, without downloading the file.

That distinction matters once data lives on Sarkoa rather than on your disk. A hosted parcel layer you can only render is a picture. A hosted parcel layer you can ask questions of is a data source your scripts, CI jobs, and AI agents can build on.

Querying vector features

sarkoa query parcels \
  --bbox -79.6,43.5,-79.1,43.9 \
  --where zone:eq:RM4 \
  --where assessed_value:gt:750000 \
  --fields address,zone,assessed_value

Or over HTTP:

POST /api/vector/{assetId}/features
{
  "bbox": [-79.6, 43.5, -79.1, 43.9],
  "filters": [
    { "field": "zone", "op": "eq", "value": "RM4" },
    { "field": "assessed_value", "op": "gt", "value": 750000 }
  ],
  "properties": ["address", "zone", "assessed_value"],
  "limit": 200
}

A GET form exists too, so a query is expressible in a URL you can paste into curl:

GET /api/vector/{assetId}/features?bbox=-79.6,43.5,-79.1,43.9&where=zone:eq:RM4

Run sarkoa inspect <file> first to see the available attribute names.

Operators

Operator Meaning
eq / neq Equal / not equal
gt / gte / lt / lte Ordered comparison
contains Case-insensitive substring
in Value is in a list

Filters are combined with AND. For OR, run two queries and merge the results.

Ordered comparisons are numeric when both sides are numbers and lexicographic otherwise, so ISO dates (2026-05-01) sort correctly with no extra configuration. Equality is tolerant of the string/number ambiguity common in GeoJSON: a CSV-derived layer carrying "5000" still matches a filter value of 5000.

Query hosted GeoJSON by extent and attribute

Download the inspection sites GeoJSON, upload it in Files, and wait for processing. First find all the sites awaiting review. Then narrow the search to one area. Use the file ID if several uploads have the same name.

sarkoa query inspection-sites --where status:eq:review --fields name,inspection_count
sarkoa query inspection-sites --where status:eq:review --fields name,inspection_count --bbox=-75.72,45.40,-75.70,45.42
sarkoa query inspection-sites --where status:eq:review --fields name,inspection_count --bbox=-75.697,45.417,-75.683,45.424

The first query returns West demonstration site (12) and East demonstration site (5). The western box returns only West (12). The last box surrounds Central, whose status is ready, so combining that box with the review filter matches zero. Bounding boxes run west, south, east, north.

For the HTTP equivalent, send the following body to POST /api/vector/{assetId}/features with your uploaded file ID and authentication:

{"bbox":[-75.72,45.40,-75.70,45.42],"filters":[{"field":"status","op":"eq","value":"review"}],"properties":["name","inspection_count"]}

The response has matched: 1 and the West site's properties. Compare it with the same inspection sites queried by an AI assistant.

The response

{
  "type": "FeatureCollection",
  "features": [ … ],
  "matched": 1284,
  "returned": 200,
  "limit": 200,
  "offset": 0,
  "hasMore": true,
  "assetId": "c47d…"
}

matched is the total number of features matching your query, not the page size. That is what tells you whether paging is worth doing.

The body is valid GeoJSON, and any reader will ignore the extra keys, so you can hand it straight to MapLibre, GDAL, or geopandas.

Paging

limit defaults to 100 and caps at 1000; a larger value is rejected with 400 rather than silently clamped, so a paging loop cannot quietly return less than it asked for.

sarkoa query parcels --where zone:eq:RM4 --limit 500 --offset 500

Keep going while hasMore is true:

let offset = 0;
for (;;) {
  const res = await fetch(`/api/vector/${assetId}/features`, {
    method: 'POST',
    headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
    body: JSON.stringify({ filters, limit: 500, offset }),
  });
  if (!res.ok) throw new Error(`Feature query failed: ${res.status} ${await res.text()}`);
  const page = await res.json();

  for (const feature of page.features) process(feature);

  if (!page.hasMore || page.features.length === 0) break;
  offset += page.features.length;
}

Break on an empty page as well as on hasMore, so a page that comes back empty cannot spin the loop forever.

Smaller responses

  • --fields a,b,c returns only those properties.
  • --no-geometry drops geometry entirely. For attribute analytics such as counts, sums, and joins, this is dramatically smaller.

Limits

Feature query reads the original upload, which must be a GeoJSON FeatureCollection. Supported GeoJSON uploads need no reprocessing. Uploads in other vector formats are not queryable through this endpoint, even when their map tiles or visualizations work.

Condition Response
File is not a vector layer 415 with reason: content_kind_not_queryable
Vector source is not GeoJSON 415 with reason: source_format_not_queryable
Source exceeds 32 MiB 413 with reason: source_too_large
Source is not a FeatureCollection 422 with reason: not_a_feature_collection

Each returns a machine-readable reason rather than an empty result, because a silently empty answer is indistinguishable from "nothing matched".

For layers above the size ceiling, filter upstream or split the layer.

Because it reads the original, a query on a file on another world uses the numbers in that file. A bounding box is compared with them as they stand, and results come back the same way, even where the hosted copy was converted, such as longitudes from 0 to 360 or planetographic latitudes.

Searching the raster catalogue

Rasters are indexed as STAC Items, searchable by space, time, and collection:

sarkoa stac search \
  --bbox -123.3,49.1,-122.9,49.4 \
  --datetime 2026-01-01/.. \
  --collection rgb
POST /api/stac/{orgId}/search
{ "bbox": [-123.3, 49.1, -122.9, 49.4], "datetime": "2026-01-01/..", "collections": ["rgb"] }

datetime accepts an instant (2026-05-01T00:00:00Z) or an interval (start/end), with .. for an open end in either direction.

Collections are assigned automatically during optimization: rgb, multispectral, singleband, elevation.

Each returned Item carries links to the data:

"assets": {
  "cog":   { "href": "…/source-download", "roles": ["data"] },
  "tiles": { "href": "…/tiles/{z}/{x}/{y}.webp", "roles": ["overview"] }
}

The catalogue is a conformant STAC API (core, collections, item-search), so standard tooling works against it:

Endpoint Purpose
/api/stac/{orgId}/catalog.json Catalog root
/api/stac/{orgId}/collections Collections with computed extents
/api/stac/{orgId}/collections/{id}/items Items in one collection
/api/stac/{orgId}/search Item search (GET and POST)

CQL2 (filter) is not implemented. Bounding box, time range, and collection cover how a raster archive is actually browsed.

The catalogue answers for one world at a time, Earth by default, so results never mix worlds. Pass target with a body name (Moon, Mars, Ceres, Europa and so on, in any case) on catalog.json, collections or search. Collections on another world carry its name, such as moon-rgb or mars-elevation, and a search naming only those needs no target. Asking for collections on two different worlds at once returns 400. Items there list the body in ssys:targets, their proj:epsg is null, and a bounding box is longitude and latitude on that world.

sarkoa stac search --target Moon --collection moon-elevation

Raster values at a point

Feature query is for vector layers. For a raster, ask what it stores at one place:

sarkoa sample elevation --at -75.69721,45.42153
elevation.tif:
Stored values (float32, nodata -9999)
  band 1: 104.25 m
  pixel column 1043, row 2210, centre -75.696123, 45.421531, 9.554629 m wide in Web Mercator

The point is longitude first, the same order as --bbox and GeoJSON. Add --json for the full answer. On another world the point is planetocentric and east-positive, and the pixel is reported in metres on that world: hosted rasters there keep Web Mercator's grid, so size3857 is a grid size, not metres on the ground, and the answer adds celestialBody and pixelSizeGroundM. AI agents use the MCP tool sample_raster with lng and lat.

Over HTTP it is part of the public API (Essential and above), with an Asset API key:

POST https://api.sarkoa.com/v1/assets/{assetId}/point
Authorization: Bearer sk_...
Content-Type: application/json

{ "lng": -75.69721, "lat": 45.42153 }

The slug form POST /v1/{orgSlug}/{datasetSlug}/point works the same way. The point goes in the body rather than the URL so it never lands in a request log.

{
  "v": 1,
  "inside": true,
  "contentRevision": "c41d07e2",
  "pixel": { "col": 1043, "row": 2210, "center": [-75.696123, 45.421531], "size3857": [9.554629, 9.554629] },
  "dataType": "float32",
  "noData": -9999,
  "alphaBand": null,
  "bands": [ { "band": 1, "value": 104.25, "status": "ok", "unit": "m" } ],
  "classIndex": null,
  "classColor": null
}

Every band comes back in the raster's own type, the alpha band included. A band whose status is not ok has a value of null:

status Meaning
ok The stored value
nodata The pixel holds the declared nodata value, or a value that is not a number
masked The alpha band makes the pixel transparent, so the map shows nothing there
empty That part of the file was never written

Outside the raster, or nearer the poles than 85.0511 degrees, the answer is { "v": 1, "inside": false, "contentRevision": "…" }. Paletted rasters also return classIndex and its [r, g, b] colour from the file; the class names live in the map's legend.

A few things to know before you rely on the numbers:

  • They are the samples of the hosted copy. Continuous rasters were reprojected to Web Mercator during optimization, so a value can differ slightly from the same spot in the file you uploaded.
  • GDAL scale, offset and unit are listed on each band but never applied. If a band has them, the physical value is value * scale + offset.
  • Point reads cover 8-bit and 16-bit unsigned, 16-bit signed, and 32-bit and 64-bit float rasters. Other types answer 422 with unsupported_sample_format.
  • A point read counts as at most one tile request per raster every 30 seconds, and none when that raster's tiles have just loaded. See Tile requests.

From an AI agent

All three are MCP tools, query_features, sample_raster and stac_search, so an agent can answer questions about your data instead of only styling it.

See also

  • CLI: sarkoa query, sarkoa sample, sarkoa stac search
  • API reference: which host serves this, and the public tile API
  • MCP: query_features, sample_raster and stac_search for agents
  • Webhooks: be told when new data lands, then query it