/honua-sdk:connect-datafrom honua-sdk
Connects code to geospatial data via @honua/sdk-js: queries OGC API Features, GeoServices FeatureServer, PMTiles archives, and Honua servers with attribute filters and spatial intersects.
Ships in honua-sdk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
One client pattern for every protocol: createHonua() → connect(locator) →
inspect() / query(). Data comes from SDK calls at run time. Do not
hand-write fetch calls and do not hard-code values you could query.
npm init -y && npm pkg set type=module
npm install --save-exact @honua/sdk-js # the published release, pinned exactly
Import from @honua/sdk-js only (createHonua, queryFilter,
spatialIntersects, envelope, point, polygon). Node 22 does not parse await using in plain
.mjs, so dispose in finally:
import { createHonua, queryFilter, spatialIntersects } from "@honua/sdk-js";
const honua = createHonua();
try {
// connections and queries
} finally {
await honua.dispose();
}
| Source | connect(...) |
|---|---|
| GeoServices layer | "<server>/rest/services/<service>/FeatureServer/<layer id>" (a service root with several layers needs sourceId) |
| OGC API Features collection | { url: "<server>/ogc/features", protocol: "ogc-features", collectionId: "<id>" } |
| OGC API Tiles | { url: "<server>/ogc/tiles", protocol: "ogc-tiles", sourceId: "<collection id>" } |
| PMTiles archive | { url: "https://…/archive.pmtiles", protocol: "pmtiles" } |
Collection ids are not names. On Honua, GET <server>/ogc/features/collections
maps ids to titles. await (await honua.connect({ url, protocol })).inspect()
lists the same sources from code.
const ogc = await honua.connect({ url: `${server}/ogc/features`, protocol: "ogc-features", collectionId });
const byPrefix = await ogc.query({ filter: queryFilter.like("<field>", "<prefix>%"), outFields: ["<field>"] });
queryFilter (eq, like, isIn, between, and,
or, ...). The SDK compiles them for each protocol (CQL2 for OGC API, a
where clause for GeoServices) and quotes values for you, so do not
interpolate user input into a where string.returnGeometry: false with
query.planning.unsupported-query. Omit it.where, outFields, returnGeometry: false, outSr
and spatialFilter.{ attributes, geometry }; read values from
feature.attributes.pagination or narrow the filter.Fetch the subject feature's geometry in WGS84, then pass it to
spatialIntersects against each overlay layer:
const subject = (await layerA.query({ filter: queryFilter.eq("<key>", "<value>"), outFields: ["*"], outSr: 4326 })).features[0];
if (!subject?.geometry) throw new Error("subject feature not found");
const within = spatialIntersects({ ...subject.geometry });
const [b, c] = await Promise.all([
layerB.query({ spatialFilter: within, outFields: ["<field b>"], returnGeometry: false }),
layerC.query({ spatialFilter: within, outFields: ["<field c>"], returnGeometry: false }),
]);
const values = b.features.map((f) => f.attributes["<field b>"]); // keep every match, not just the first
A polygon can intersect several overlay polygons. Report all of them, joined
(for example "AE; X").
const archive = await honua.connect({ url: pmtilesUrl, protocol: "pmtiles" });
const meta = (await archive.inspect()).sources[0].metadata.pmtiles;
// meta.minZoom, meta.maxZoom, meta.bounds [w, s, e, n], meta.center, meta.tileKind,
// meta.vectorLayers[].id
The metadata sits under .metadata.pmtiles, not .metadata. PMTiles sources
do not support query(); it throws a capability error. Render them with the
map runtime instead (see the build-a-map-app skill).
SDK errors carry sdkCode and category. category: "capability" means the
protocol cannot do what you asked, so change the query and do not retry.
core.http.transient (for example an HTTP 408) is retryable. Honua's demo server
allows 60 requests a minute per client, so keep scripts to a handful of
queries and use Promise.all only for independent calls.
Run the script, then check one value against the server directly, for example
<layer>/query?where=…&f=json in a browser. A mismatch usually means you kept
only the first intersecting overlay.
What SKILL.md sets; muted values are Claude Code's defaults
2 skills in this plugin
Other plugins' skills for the same job
npx claudepluginhub honua-io/honua-sdk-js --plugin honua-sdk