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/sdkUse
@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
| Import | Includes |
|---|---|
@embedearth/sdk | E2 with browser HTTP search, routing, catalogs, and the compute builder. |
@embedearth/sdk/node | Node-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
SearchRemote, offline, and automatic queries.RoutesTyped route and network analysis methods.MapDeploy a MapLibre map with PMTiles anywhere.Spatial ComputeFluent spatial analysis over managed or supported local data.StorageUpload your own GeoJSON, CSV, or Parquet.CatalogsResolve features, regions, and published datasets.
