Search published features
Query one or more features and areas as one GeoJSON FeatureCollection.
Documentation navigation
Start with E2
SDK guides
CLI guides
MCP guides
Applications
Framework quickstarts
Query features
search.ts
import { E2 } from "@embed-earth/sdk-test";
const e2 = new E2();
const result = await e2.search({
feature: ["restaurant", "school"],
area: ["Manhattan", "Queens"],
mode: "auto",
limit: 1000,
where: { wheelchair: "yes" },
properties: { operator: "public" },
columns: ["id", "name", "lat", "lng"],
});
// { type: "FeatureCollection", features: [...] }Pass a feature key, alias, or numeric feature ID.
area accepts a name or names and resolves them through the region catalog. Use regionId instead when you already have canonical IDs, but do not pass both.Browser bundles post each search request to
/search. Set searchUrl on E2 when your API is hosted elsewhere.Search options
| Option | Type | Behavior |
|---|---|---|
feature | string | number | array | Required. One or more feature keys or IDs. |
area | string | array | Named areas resolved to region IDs. |
regionId | string | array | Canonical region IDs such as e2r:region:... . |
mode | remote | offline | auto | Remote download, cached-only query, or cache-first automatic selection. |
bbox | [minLng, minLat, maxLng, maxLat] | Restrict rows to a bounding box. |
where | record | Typed filters for exposed columns. |
properties | record | String, number, or boolean property filters. |
columns | string[] | Select an allow-listed set of row columns. |
limit | number | Clamped to 1 through 100,000; defaults to 1,000. |
Remote, offline, and auto
modes.ts
await e2.search({ feature: "restaurant", mode: "remote" });
await e2.search({ feature: "restaurant", mode: "offline" });
await e2.search({ feature: "restaurant", mode: "auto" });In Node, auto uses local snapshots when available and otherwise fetches published data. In a browser, search posts the same request to the configured HTTP /search endpoint. offline fails when requested data is not available locally.
Custom executors
executor.ts
import { E2, type SearchExecutor } from "@embed-earth/sdk-test";
const executor: SearchExecutor = {
query: async (query) => ({ rows: await mySnapshotQuery(query) }),
};
const e2 = new E2({ search: executor });The browser-safe SearchClient accepts any executor that returns rows. The SDK converts each row to GeoJSON and merges row fields with its properties object.
