Analyze Earth features

Run nearest, distance, coverage, clustering, and more against remote, cached, or local features.

Documentation navigation

Compute remote features

compute.ts
import { E2 } from "@embed-earth/sdk-test";

const e2 = new E2();
const count = await e2.compute.feature("restaurant")
  .region("Manhattan")
  .near("park", 500)
  .count();

const offlineCount = await e2.compute.feature("restaurant")
  .region("Manhattan")
  .near("park", 500)
  .mode("offline")
  .count();

Fluent query methods

query.ts
const results = await e2.compute.feature(["restaurant", "hospital"])
  .region("e2r:region:nyc")
  .within("school", 1000)
  .limit(100)
  .nearest();

Use region(), near(), within(), and limit() to build a request. within() with no arguments executes the WITHIN primitive.

Compute primitives

PrimitiveReturns
nearest()Source rows sorted by nearest related row.
distance()Source IDs, nearest IDs, and distances in meters.
within()Source rows within the relation distance.
count()The number of matching rows.
density()Rows per square kilometer of the relation radius.
coverage()The fraction of target rows served by source rows.
gaps()Target rows not covered by a source row.
cluster()Simple radius-based clusters with counts and IDs.

Direct requests

request.ts
const value = await e2.compute.run({
  primitive: "COVERAGE",
  feature: "restaurant",
  region: "e2r:region:nyc",
  within: { feature: "park", distanceMeters: 500 },
  limit: 1000,
});

Compare features or areas

compare.ts
const featureComparison = await e2.compute.compare({
  features: ["restaurant", "hospital"],
  region: "Manhattan",
});

const areaComparison = await e2.compute.compare({
  feature: "restaurant",
  areas: ["Manhattan", "Brooklyn"],
});