For the complete documentation index, see llms.txt. This page is also available as Markdown.

JavaScript SDK

Embed Felt maps in your web application with the JavaScript SDK. Use code to control layers, filters, the viewport, and clicks.

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.

  1. Install the SDK from npm with npm install @feltmaps/js-sdk.

  2. In Felt, open the map in edit mode. In the toolbar, click Developer Platform > Copy map ID.

  3. In your application, call Felt.embed with the element that should hold the map and the map ID. The map loads, and Felt.embed returns a controller.

  4. 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?