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:

terminal
mkdir my-e2-app && cd my-e2-app
npm init -y
Start with EDK Cloud when you want managed infrastructure. Supported local and offline workflows are available when you need direct control or no network access. EDK is open source — read or contribute to the code at github.com/edk-earth/edk.

Install the SDK

terminal
npm install @edk/sdk

The 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

search.ts
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"
Pass a feature key, alias, or numeric feature ID. 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

routing.ts
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

compute.ts
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

ModeHow it worksUse when
LocalData 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 CloudThe SDK calls managed EDK APIs over HTTP.You want zero setup, fresh data, or browser-only apps.
Automaticmode: "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.

Next steps