Search published features

Query one or more features and areas as one GeoJSON FeatureCollection.

Documentation navigation

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

OptionTypeBehavior
featurestring | number | arrayRequired. One or more feature keys or IDs.
areastring | arrayNamed areas resolved to region IDs.
regionIdstring | arrayCanonical region IDs such as e2r:region:... .
moderemote | offline | autoRemote download, cached-only query, or cache-first automatic selection.
bbox[minLng, minLat, maxLng, maxLat]Restrict rows to a bounding box.
whererecordTyped filters for exposed columns.
propertiesrecordString, number, or boolean property filters.
columnsstring[]Select an allow-listed set of row columns.
limitnumberClamped 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.