JavaScript SDK
Embed Felt maps in your web application with the JavaScript SDK. Use code to control layers, filters, the viewport, and clicks.
Available with the Platform add-on. Compare plans
Embed a Felt map with the JavaScript SDK to control it from your application. Set the view, show or filter layers, respond to feature clicks, and add data at runtime. The SDK reference lists every method and event.
What you can do with the JavaScript SDK
Felt.embed returns a controller for the embedded map. With it, your application can:
Set and read the viewport, and zoom to features or areas.
Show, hide, filter, and restyle layers and layer groups.
Read features and their attributes, with the option to limit results to features in view.
Listen for events, such as clicks on the map, changes to the selection, or changes to the viewport.
Switch drawing tools and react when someone draws a shape.
Add temporary layers from GeoJSON, whether from a URL, a file, or data in the page.
Add buttons, panels, and other UI inside the map.
Layers the SDK adds from GeoJSON are temporary. They load in the browser showing the map and aren't saved to the map. To add data that stays on the map, upload it in Felt or with the REST API.
The JavaScript SDK also powers custom extensions, which run on the Felt map itself. Felt AI can write them for you.
Embed a map with the JavaScript SDK
The getting started guide has the code for each step.
Install the SDK from npm with
npm install @feltmaps/js-sdk.In Felt, open the map in edit mode. In the toolbar, click Developer Platform > Copy map ID.
In your application, call
Felt.embedwith the element that should hold the map and the map ID. The map loads, andFelt.embedreturns a controller.Use the controller's methods and events to connect the map to the rest of your page.
A map with public link access loads for anyone. For a private map, add an embed token. See Authenticated embeds.
Last updated
Was this helpful?