Deploy a map anywhere
EDK gives you a MapLibre renderer with a global Planet basemap, published feature tiles, routing, and spatial compute. The map runs in your browser and can be hosted by any static or server-rendered web platform.
Documentation navigation
Install
npm install @edk/sdk maplibre-gl@edk/sdk/map. It keeps MapLibre and PMTiles out of your application code while leaving the renderer under your control.Create a map
import { createMap } from "@edk/sdk/map";
import "maplibre-gl/dist/maplibre-gl.css";
const map = createMap({
container: "map",
center: [-73.99, 40.74],
zoom: 11,
});
await map.addFeatures(["restaurant", "accidents"]);
await map.route({
locations: [
{ lat: 40.74, lon: -73.99 },
{ lat: 40.71, lon: -74.01 },
],
mode: "walking",
});
map.destroy();If you already have an EDK client, use e2.map.create({ ... }) so search, routing, compute, and map layers share the same client configuration.
Use your own tile URL
const map = createMap({
container: "map",
planetSource: "https://tiles.example.com/basemaps/planet.pmtiles",
});https://tiles.edk.earth/basemaps/planet.pmtiles. A custom origin or CDN must support HTTP range requests and expose browser CORS headers, including Content-Range.Where can I deploy it?
| Host | What you deploy | Notes |
|---|---|---|
| Vercel | Your React/Next.js app | Use a public or protected route; the map still fetches tiles from planetSource. |
| Cloudflare Pages | Static build or SPA | Pair it with a proxied tile hostname for CDN delivery. |
| Netlify | Your frontend bundle | No special server is required for the renderer. |
| Own server | Static assets and app | Serve the map container and JavaScript over HTTPS. |
Cloudflare is optional for app hosting. It is useful as the CDN and origin shield for Planet PMTiles; it is not an access gate by itself. Add signed URLs, a Worker check, or Cloudflare Access when the tiles must be private.
Add data and analysis
await map.addFeature("service_requests", {
area: "Manhattan",
limit: 1000,
color: "#b68cff",
});
const result = await map.compute({
primitive: "COUNT",
feature: "restaurant",
region: "Manhattan",
});Published feature PMTiles are used when available. Otherwise the SDK falls back to EDK search and adds the result as GeoJSON. Routes and GeoJSON compute results are drawn on the same MapLibre instance.