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
| Field | Type | Default | Meaning |
|---|---|---|---|
initialView.center | [number, number] | [-79.4346, 41.1922] | WGS84 center [lng, lat] |
initialView.zoom | number | 15 | Initial MapLibre zoom |
initialView.bearing | number | 0 | Initial rotation (degrees clockwise from north) |
basemap | "basemap" | "satellite" | "hybrid" | "basemap-2.5d" | "hybrid-2.5d" | "hybrid" | Starting basemap |
layerPanel | boolean | false | Built-in panel for visibility/opacity/reorder |
hud | boolean | false | Zoom + scale display |
tools.measurement.controls | boolean | true | Built-in measurement buttons |
sync.enabled | boolean | false | Enables optional Potree runtime sync |
sync.master | "auto" | "map2d" | "potree" | "auto" | Sync authority strategy |
sync.mapPriorityMs | number | 1200 | Time window where recent map input takes priority |
sync.potree.throttleMs | number | 50 | Potree-to-map update throttle |
layers | Layer[] | [] | Initial layers to render |
Layer object fields
| Field | Type | Required | Meaning |
|---|---|---|---|
id | string | Yes | Stable unique identifier |
name | string | Yes | Human-readable label |
type | "raster" | "pmtiles" | Yes | Source type |
url | string | Yes | Tiles URL or PMTiles URL |
visible | boolean | No | Defaults to true |
opacity | number | No | 0 to 1, defaults to 1 |
order | number | No | Relative drawing order |
scheme | "xyz" | "tms" | No | Raster only; tile coordinate scheme, default xyz |
sourceLayer | string | No | PMTiles only; vector layer name inside the file, defaults to layer id |
style | PMTilesStyle | No | PMTiles 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.
| Field | Type | Default | Meaning |
|---|---|---|---|
secondaryColor | string | '#8b4513' | Color for non-master contour lines |
secondaryWidth | number | 1 | Width (px) for non-master contour lines |
secondaryOpacityFactor | number | 0.6 | Opacity multiplier applied to secondary lines |
masterColor | string | '#fbbf24' | Color for master contour lines |
masterWidth | number | 3 | Width (px) for master contour lines |
labelColor | string | '#78350f' | Elevation label text color |
labelSize | number | 14 | Elevation label font size (px) |
labelHaloColor | string | '#ffffff' | Elevation label halo color |
labelHaloWidth | number | 2 | Elevation label halo width (px) |
elevProperty | string | 'elev' | Feature property name holding the elevation/depth value |
masterInterval | number | 5 | Elevation modulo divisor — every Nth contour is promoted to master |
labelSuffix | string | ' 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
pmtilesCLI to inspect a file's internal layer names and feature property names before configuringsourceLayerandelevProperty.
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
layerPanelandhudare 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.