Documentation / Components · Maps

MapClusterLayer

Group nearby GeoJSON points in a map layer..

ROM UI 0.1.0-alpha.7 Markdown

Group nearby GeoJSON points in a map layer.

Public import

svelte
<script lang="ts">
  import { MapClusterLayer } from "rom-ui/maps";
  import "rom-studio/styles";
</script>

Composition and responsibility

The host supplies data, callbacks and application policy. The component does not provide persistence or authorization.

Public names: MapClusterLayer.

Declared props

This declaration comes from the installed package. Imported types retain their upstream meaning.

ts
interface Props {
    /** GeoJSON FeatureCollection data or URL to fetch GeoJSON from */
    data: string | GeoJSON.FeatureCollection<GeoJSON.Point, P>;
    /** Maximum zoom level to cluster points on (default: 14) */
    clusterMaxZoom?: number;
    /** Radius of each cluster when clustering points in pixels (default: 50) */
    clusterRadius?: number;
    /** Colors for cluster circles: [small, medium, large] based on point count (default: ["#3b82f6", "#1d4ed8", "#1e3a8a"]) */
    clusterColors?: [string, string, string];
    /** Point count thresholds for color/size steps: [medium, large] (default: [100, 750]) */
    clusterThresholds?: [number, number];
    /** Color for unclustered individual points (default: "#3b82f6") */
    pointColor?: string;
    /** Callback when an unclustered point is clicked */
    onpointclick?: (
      feature: GeoJSON.Feature<GeoJSON.Point, P>,
      coordinates: [number, number],
    ) => void;
    /** Callback when a cluster is clicked. If not provided, zooms into the cluster */
    onclusterclick?: (
      clusterId: number,
      coordinates: [number, number],
      pointCount: number,
    ) => void;
  }

Source and version

ROM UI 0.1.0-alpha.7. Component source.

Install the optional maplibre-gl peer and its styles. Provider contracts and attribution remain host responsibilities.

See the composition guide for host integration boundaries.

This page follows the captured repository source.View the source