Layers

Layers render data on the map — points, lines, and polygons with static or data-driven styling.

Supported layer types: geojson, parquet, route, heatmap, mvt, and raster. For route lines, see Routes. For heatmaps, see Heatmap. For tile layers, see Tile Layers.

Basic Usage

{
  "layers": {
    "buildings": {
      "type": "geojson",
      "data": "https://example.com/buildings.geojson",
      "style": {
        "fillColor": "#3498db",
        "opacity": 0.6,
        "lineColor": "#2980b9",
        "lineWidth": 1
      },
      "tooltip": ["name", "height"]
    }
  }
}

Properties

PropertyTypeRequiredDescription
type"geojson"YesLayer type
datastring | objectYesGeoJSON URL or inline GeoJSON object
styleLayerStyleNoVisual style for the layer
tooltipstring[]NoFeature property names to show on hover
clusterbooleanNoEnable point clustering
clusterOptionsClusterOptionsNoClustering configuration

Style Properties

PropertyTypeDefaultDescription
fillColorColorValue"#3b82f6"Polygon fill color
pointColorColorValue(uses fillColor)Point circle color
lineColorColorValue"#333333"Line / polygon outline color
lineWidthnumber1Line width in pixels
pointRadiusSizeValue5Point circle radius in pixels
opacitynumber0.8Overall opacity (0–1)

A ColorValue can be a static hex string or a data-driven mapping. See Color System.

A SizeValue can be a static number or a data-driven continuous mapping:

{
  "pointRadius": {
    "type": "continuous",
    "attr": "mag",
    "domain": [0, 8],
    "range": [2, 12]
  }
}

Clustering

Enable point clustering to group nearby points at lower zoom levels:

{
  "layers": {
    "stores": {
      "type": "geojson",
      "data": "https://example.com/stores.geojson",
      "cluster": true,
      "clusterOptions": {
        "radius": 50,
        "maxZoom": 14,
        "minPoints": 2,
        "colors": ["#22c55e", "#eab308", "#ef4444"]
      }
    }
  }
}
OptionTypeDefaultDescription
radiusnumber50Cluster radius in pixels
maxZoomnumber14Max zoom level for clustering
minPointsnumber2Minimum points per cluster
colors[string, string, string]green/yellow/redColors for small/medium/large clusters

Geometry Handling

A single GeoJSON source can contain mixed geometry types. The renderer automatically creates:

  • Fill sublayer for Polygon / MultiPolygon features
  • Line sublayer for all features (outlines + LineString)
  • Circle sublayer for Point / MultiPoint features

Data Sources

URL string — fetched at render time:

{ "data": "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson" }

Inline GeoJSON — embedded in the spec:

{
  "data": {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "geometry": { "type": "Point", "coordinates": [-73.98, 40.75] },
        "properties": { "name": "NYC" }
      }
    ]
  }
}

GeoParquet Layers

Load GeoParquet files directly from a URL. The geometry column is auto-detected from GeoParquet metadata, and the map auto-fits to the data bounds.

{
  "layers": {
    "buildings": {
      "type": "parquet",
      "data": "https://example.com/buildings.parquet",
      "style": {
        "fillColor": "#3b82f6",
        "opacity": 0.7
      }
    }
  }
}
PropertyTypeRequiredDescription
type"parquet"YesLayer type
datastringYesURL to a GeoParquet file
geometryColumnstringNoGeometry column name (auto-detected if omitted)
styleLayerStyleNoSame style system as GeoJSON layers
tooltipstring | string[]NoProperty names to show on hover (all columns if omitted)
clusterbooleanNoEnable point clustering
clusterOptionsClusterOptionsNoClustering configuration

Parquet layers support zstd, brotli, gzip, lz4, and snappy compression. The file is fetched client-side and converted to GeoJSON internally.

Data-Driven Color

See Color System for full documentation. Quick examples:

Continuous — numeric property to gradient:

{ "fillColor": { "type": "continuous", "attr": "population", "palette": "Sunset", "domain": [0, 1000000] } }

Categorical — string property to discrete colors:

{ "fillColor": { "type": "categorical", "attr": "zone_type", "palette": "Bold" } }

Legend

When a layer has data-driven color, you can add an auto-generated legend. See Legend.

Events

Layer clicks fire the onLayerClick callback. See Events.

Example

Live USGS earthquake data with magnitude-based coloring: