Skip to content

map2d Schema

mapprism-2d (the 2D plugin inside the MapPRISM system) reads its initial state from config.map2d.

This is the only configuration namespace the library consumes. You can keep the rest of your MapPRISM config unchanged.


Full example

json
{
  "map2d": {
    "initialView": {
      "center": [-79.4346, 41.1922],
      "zoom": 15,
      "bearing": 0
    },
    "basemap": "hybrid",
    "layerPanel": true,
    "hud": true,
    "tools": {
      "measurement": {
        "controls": true
      }
    },
    "sync": {
      "enabled": false,
      "master": "auto",
      "mapPriorityMs": 1200,
      "potree": {
        "throttleMs": 50
      }
    },
    "layers": [
      {
        "id": "xyz_dem",
        "name": "DEM",
        "type": "raster",
        "url": "https://example.com/{z}/{x}/{y}.png",
        "visible": true,
        "opacity": 1,
        "order": 0,
        "scheme": "tms"
      },
      {
        "id": "piney_contours",
        "name": "Contours",
        "type": "pmtiles",
        "url": "https://example.com/piney_contours.pmtiles",
        "visible": true,
        "opacity": 1,
        "order": 4
      }
    ]
  }
}

Top-level map2d fields

FieldTypeDefaultMeaning
initialView.center[number, number][-79.4346, 41.1922]WGS84 center [lng, lat]
initialView.zoomnumber15Initial MapLibre zoom
initialView.bearingnumber0Initial rotation (degrees clockwise from north)
basemap"basemap" | "satellite" | "hybrid" | "basemap-2.5d" | "hybrid-2.5d""hybrid"Starting basemap
layerPanelbooleanfalseBuilt-in panel for visibility/opacity/reorder
hudbooleanfalseZoom + scale display
tools.measurement.controlsbooleantrueBuilt-in measurement buttons
sync.enabledbooleanfalseEnables optional Potree runtime sync
sync.master"auto" | "map2d" | "potree""auto"Sync authority strategy
sync.mapPriorityMsnumber1200Time window where recent map input takes priority
sync.potree.throttleMsnumber50Potree-to-map update throttle
layersLayer[][]Initial layers to render

Layer object fields

FieldTypeRequiredMeaning
idstringYesStable unique identifier
namestringYesHuman-readable label
type"raster" | "pmtiles"YesSource type
urlstringYesTiles URL or PMTiles URL
visiblebooleanNoDefaults to true
opacitynumberNo0 to 1, defaults to 1
ordernumberNoRelative drawing order
scheme"xyz" | "tms"NoRaster only; tile coordinate scheme, default xyz
sourceLayerstringNoPMTiles only; vector layer name inside the file, defaults to layer id
stylePMTilesStyleNoPMTiles only; visual and data-model overrides (see below)

PMTiles style object

The optional style property on a PMTiles layer controls both visual appearance and how the contour data is interpreted. All fields are optional — unset values fall back to the defaults below.

FieldTypeDefaultMeaning
secondaryColorstring'#8b4513'Color for non-master contour lines
secondaryWidthnumber1Width (px) for non-master contour lines
secondaryOpacityFactornumber0.6Opacity multiplier applied to secondary lines
masterColorstring'#fbbf24'Color for master contour lines
masterWidthnumber3Width (px) for master contour lines
labelColorstring'#78350f'Elevation label text color
labelSizenumber14Elevation label font size (px)
labelHaloColorstring'#ffffff'Elevation label halo color
labelHaloWidthnumber2Elevation label halo width (px)
elevPropertystring'elev'Feature property name holding the elevation/depth value
masterIntervalnumber5Elevation modulo divisor — every Nth contour is promoted to master
labelSuffixstring' in'Unit suffix appended to elevation labels (e.g. ' ft', ' m')

Example — Chicago Harbor Lock contours

json
{
  "id": "chicago_contours",
  "name": "Chicago Harbor Lock - Contours",
  "type": "pmtiles",
  "url": "https://storage.mapprism.com/demo/chicago-harbor-lock/dist/Chicago Harbor Lock - Contours.pmtiles",
  "visible": true,
  "opacity": 1,
  "order": 4,
  "sourceLayer": "contours",
  "style": {
    "elevProperty": "depth",
    "masterInterval": 5,
    "labelSuffix": " ft"
  }
}

Tip: Use a tool like pmtiles-inspector or the pmtiles CLI to inspect a file's internal layer names and feature property names before configuring sourceLayer and elevProperty.


Configuration behavior notes

Coordinates

  • Public map coordinates are always WGS84 ([lng, lat]).
  • EPSG:3857 values from Potree-facing systems are converted at the integration boundary.

scheme for raster layers

Use scheme: "tms" for y-inverted tilesets (common in MapPRISM demo data).
Use scheme: "xyz" for standard XYZ tile servers.

UI toggles

  • layerPanel and hud are optional conveniences.
  • If disabled, all core capabilities remain available through the API.

Sync settings

  • Start with transition-time handoff (getView / setView) first.
  • Enable continuous sync only when your UX requires both viewers to stay live-linked.