How to add a splat model to your map

This example shows how to initialize a map using the MapTiler GeoSplats SDK and add a splat model at a specific position. Unlike traditional 3D meshes, splats are based on Gaussian splatting technology, using a collection of tiny ellipsoids with varying opacity.

Click the SD/HD button to change the model definition

NPM module setup


npm install --save @maptiler/geosplats
import { SplatModel, Map, config } from "@maptiler/geosplats";
import '@maptiler/geosplats/dist/maptiler-geosplats.css';

config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
const map = new Map({
  apiKey: config.apiKey,
  container: "map",
  center: [-80.27822, 25.74077],
  zoom: 17.26
});

map.on("load", () => {
  const splatModel = new SplatModel({
    model: "YOUR_MAPTILER_SPLAT_MODEL_ID_HERE",
  });
  map.addSplatModel(splatModel);
});

High-performance rendering

By using the GeoSplats SDK, you can efficiently render millions of splats. Splats are ideal for representing complex scenes that are traditionally difficult to model, such as:

  • Dense vegetation and trees
  • Thin wires and structures
  • Semi-transparent surfaces

The WebGPU API enables efficient rendering of massive 3D datasets. Modern devices (typically 2020 or newer) with hardware acceleration enabled will provide the best high-fidelity experience for your users.

What are GeoSplats?

GeoSplats are the result of an optimized pipeline that converts raw standard splats (.ply files) into a location-aware format. This format supports precise geographic coordinates, fast loading via specialized spatial chunks, and smooth terrain blending.

Learn more

Check out the MapTiler GeoSplats SDK JS reference

Edit model in custom editor

Edit model in custom editor

Examples

Build a custom 3D editor to adjust the position, rotation, and scale of splat models and save their properties to a database.

Capture map and splats events

Capture events

Examples

Learn how to capture both global map events and specific splats events like load, update, mouseover, and click.

Change map basemap

Change basemap

Examples

Learn how to dynamically switch between different MapTiler basemaps while maintaining photorealistic 3D splats models in your scene.

Change the opacity and visibility of splats

Opacity and visibility

Examples

Learn how to dynamically control the transparency and visibility of photorealistic splats objects using the MapTiler GeoSplats SDK.

Was this helpful?