Your first EDK query
Install the SDK, search the physical world, and use the result in a route or spatial computation.
Documentation navigation
Prerequisites
The EDK JavaScript SDK requires Node.js 20 or newer and npm. Any operating system that runs Node works. Create a project if you do not have one:
mkdir my-e2-app && cd my-e2-app
npm init -yInstall the SDK
npm install @edk/sdkThe browser-safe import selects the HTTP backend in browsers and the Node backend on the server. Node 20 or newer is required.
Your first search
import { EDK } from "@edk/sdk";
const e2 = new EDK({ cacheDirectory: "./.e2-cache" });
const result = await e2.search({
feature: ["restaurant", "school"],
area: ["Manhattan", "Queens"],
mode: "auto",
limit: 1000,
columns: ["id", "name", "lat", "lng"],
});
console.log(result.type); // "FeatureCollection"area accepts a name or names and resolves them through the region catalog. auto uses local snapshots when available and otherwise fetches published data.Add routing
const route = await e2.route.route({
locations: [
{ lat: 40.74, lon: -73.99 },
{ lat: 40.71, lon: -74.01 },
],
mode: "walking",
});
const area = await e2.route.isochrone({
locations: [{ lat: 40.74, lon: -73.99 }],
mode: "walking",
contours: [{ time: 10 }, { time: 20 }],
});The same client also provides matrices, map matching, locate, and height. See the Routes guide for every operation.
Run compute
const count = await e2.compute.feature("restaurant")
.region("Manhattan")
.near("park", 500)
.count();
const results = await e2.compute.feature(["restaurant", "hospital"])
.region("e2r:region:nyc")
.within("school", 1000)
.limit(100)
.nearest();Compute chains region(), near(), within(), and limit() and finishes with a primitive such as count() or nearest(). See the Compute guide for all eight primitives.
Cloud and local execution
| Mode | How it works | Use when |
|---|---|---|
| Local | Data lives in a local SQLite index under your cacheDirectory. Queries run on your machine. | You want offline access, full data ownership, or no per-request cost. |
| EDK Cloud | The SDK calls managed EDK APIs over HTTP. | You want zero setup, fresh data, or browser-only apps. |
| Automatic | mode: "auto" prefers local snapshots and falls back to the network. | You want local speed with hosted data as a safety net. |
Point cacheDirectory at a directory you control to enable local data. Omit it for remote-only access. The same mode option appears on search and compute, so one client covers both.