EmbedEarth for JavaScript and TypeScript

Build programmable geography into JavaScript and TypeScript applications with Search, Routes, spatial Compute, data, and maps.

Documentation navigation

Install

terminal
npm install @embedearth/sdk
Use @embedearth/sdk everywhere. The package selects the browser HTTP backend or the Node local-data backend automatically. Import @embedearth/sdk/node only when you need Node-only helpers such as SQLite, cache management, or uploads. The Node runtime requires Node 20 or newer.

Quick start

search.ts
import { E2 } from "@embedearth/sdk";

const e2 = new E2({ cacheDirectory: "./.e2-cache" });
const places = await e2.search({
  feature: ["restaurant", "hospital"],
  area: ["Manhattan", "Brooklyn"],
  mode: "auto", limit: 500,
});

console.log(places.type); // "FeatureCollection"

Browser-safe and Node APIs

ImportIncludes
@embedearth/sdkE2 with browser HTTP search, routing, catalogs, and the compute builder.
@embedearth/sdk/nodeNode-only cache, database, upload, download, and snapshot helpers.

Search and compute use the browser HTTP /search backend or Node snapshots automatically. Pass a local database as compute only for local analysis.

Search or compute from a point

Pass latitude and longitude to search or compute when the user has a map point. EmbedEarth resolves the point to the most specific available Region—city, then state, then country—before choosing available data.

Guides

Next step