Map, without the lock-in
E2M is the MapLibre wrapper for E2. It starts with the Planet PMTiles basemap, adds published feature tiles when available, and keeps search, routing, and compute on the same client.
Documentation navigation
Start with E2
SDK guides
CLI guides
MCP guides
Applications
Framework quickstarts
Install
npm install maplibre-gl pmtiles @embed-earth/sdk-testE2M from the main SDK entry. The browser bundle owns MapLibre and PMTiles; the regular E2 client remains the source of search, datasets, routing, and compute.Create a map
import { E2M } from "@embed-earth/sdk-test";
import "maplibre-gl/dist/maplibre-gl.css";
const map = new E2M({
container: "map",
center: [-73.99, 40.74],
zoom: 11,
});No backend wiring is needed for normal use. E2M uses the SDK's built-in search and routing clients, and the E2 client can still be supplied when an application already has one.
Display E2 features
// Uses the newest published overall PMTiles snapshot when one exists.
await map.addFeatures(["restaurant", "accidents"]);
// Search is the fallback for a feature without published PMTiles.
await map.addFeature("service_requests", {
area: "Manhattan",
limit: 1000,
color: "#b68cff",
});Feature PMTiles are resolved from the snapshot index and loaded with HTTP range requests. Search results are added as GeoJSON sources when no usable pmtilesDownloadUrl exists.
Routing and compute
const route = await map.route({
locations: [
{ lat: 40.74, lon: -73.99 },
{ lat: 40.71, lon: -74.01 },
],
mode: "walking",
});
const result = await map.compute({
primitive: "COUNT",
feature: "restaurant",
region: "Manhattan",
});Routes are drawn as line layers when the routing response contains GeoJSON or Valhalla encoded leg shapes. GeoJSON compute results become a map layer; scalar results are returned unchanged.
CLI and MCP
| Interface | Map operation |
|---|---|
e2 map sources restaurant accidents | Resolve Planet and published feature PMTiles sources. |
e2_map_sources | Return the same sources to an MCP client. |
e2.map.sources(["restaurant"]) | Resolve sources without creating a renderer. |
