Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

3.8 KB
Raw Blame

Examples

A list of examples demonstrating how to add kepler.gl to your app. Most examples are standalone projects that can be run locally. The Live Data harness is started from the repo root (yarn start:live-data) so it can bundle local src/.

Getting started

Each example has its own package.json. To run one, cd into its folder and install dependencies:

touch yarn.lock && yarn

touch yarn.lock is required the first time so Yarn treats the folder as a standalone project, independent from the kepler.gl monorepo.

Then start the dev server:

yarn start

Examples

  • Get Started

    Minimal kepler.gl setup with esbuild.

  • Get Started (Vite)

    Minimal kepler.gl setup with Vite.

  • DuckDB (Vite)

    Minimal kepler.gl setup with the DuckDB plugin and Vite.

  • Demo App

    kepler.gl as a full single-page app — loads sample maps from remote URLs and saves map data to Dropbox. This is also the source code of kepler.gl/#/demo.

  • Open Modal

    Embed kepler.gl inside a react-modal dialog, demonstrating both fresh-state and saved-state lifecycle behaviors.

  • Custom Reducer

    Customize the kepler.gl reducer's initial state and extend it with additional actions using the plugin system.

  • Replace UI Component

    Replace kepler.gl's default UI components using the injectComponents method.

  • Custom Theme

    Customize the kepler.gl theme by overriding default style properties.

  • Clicked Feature

    Read visState.clicked from Redux and show a GeoJSON feature's shapeName in a host-app sidebar outside the map.

  • Live Data

    Remotely hosted CSV of points orbiting San Francisco on a 2-minute loop. Toggle Poll URL (HTTP snapshot replace every 300 ms), Host rows (addToDataset / removeFromDataset, including upsert and delete by id), and WebSocket (host maps ws upserts onto addToDataset; Kepler is not a websocket client).

  • Custom Layer

    Add a custom deck.gl layer (ContourLayer) to kepler.gl's layer type selector, so it can be picked from the dropdown, configured with dataset columns, and rendered on the map.

  • Custom Map Style

    Use kepler.gl with basemap services other than Mapbox (e.g. MapLibre / Carto).

  • Node App

    Embed kepler.gl in a Node.js/Express application — builds the bundle with esbuild and serves it as static files.

  • UMD Client

    A single HTML file that loads kepler.gl from CDN — no build tool or npm install required. Works when opened directly from disk.

Mapbox token

All examples default to a MapLibre / Carto basemap so they work without any token.

If you want to use Mapbox basemaps, set the MapboxAccessToken environment variable before starting an example:

export MapboxAccessToken=<your_mapbox_token>
yarn start

For umd-client (no build step), edit index.html and set window.MAPBOX_TOKEN near the top of the file instead.

For demo-app, create a .env file from .env.template at the repo root and fill in MAPBOX_ACCESS_TOKEN and other optional cloud integration tokens.