On this page

Class SplatModel

Represents a photorealistic 3D visualization (SplatModel) that can be positioned on the map.

Hierarchy (View Summary)

Index

Constructors

  • Creates a new SplatModel instance.

    Parameters

    • options: SplatModelOptions

      The options for the SplatModel.

    Returns SplatModel

    const splatModel = new SplatModel({
      model: "7d943f61-56fc-44fe-aa9e-db4afa115813",
      center: [14.418269, 50.095494]
    });
    

Properties

loaded: boolean = false

Methods

  • Moves the camera such that the model is centered in the viewport. Sets pitch to 60 degrees while keeping current yaw.

    Parameters

    Returns LngLat | null

    The center of the SplatModel as LngLat, or null if not initialized.

  • Returns the current altitude of the model in meters.

    Returns number

    The altitude in meters, or NaN if not initialized.

  • Returns the current center of the model as LngLat.

    Returns LngLat | null

    The center position, or null if not available.

  • Returns the model identifier (URL or UUID).

    Returns string

    The model string.

  • Returns the options used to create this SplatModel.

    Returns SplatModelOptions

    The SplatModel options.

  • Returns the model's scale.

    Returns number

    The scale factor, or NaN if not initialized.

  • Hides the SplatModel, disables listeners, and sets opacity to 0.

    Returns void

  • Sets the altitude of the model in meters.

    Parameters

    • altitude: number

      The new altitude in meters.

    Returns void

  • Sets the visibility and color of the model's bounding box.

    Parameters

    • visible: boolean

      Whether the bounding box should be visible.

    • color: Color | null = null

      The color of the bounding box. Can be a string ("red", "#ff0000"), RGB(A) array, or object.

    Returns void

    splatModel.setBoundingBox(true, "yellow");
    splatModel.setBoundingBox(true, [255, 204, 0, 0.4]);
    
  • Sets whether the model is draggable.

    Parameters

    • draggable: boolean

      Whether the model should be draggable.

    Returns void

  • Sets the opacity of the model.

    Parameters

    • opacity: number

      The new opacity value (clamped between 0 and 1).

    Returns void

  • Sets the scale of the model.

    Parameters

    • scale: number

      The new scale factor.

    Returns void

  • Shows the SplatModel and re-enables listeners.

    Returns void

  • Snaps the model to the terrain and returns the new altitude.

    Parameters

    • callback: (elevation: number) => void

      Function called with the snapped elevation.

    Returns number

Was this helpful?

GeoSplats SDK
Reference
SplatModel