Skip to content
EN

Layers & Uploads

POST /api/layers/upload (token permission: upload)
Content-Type: multipart/form-data

Fields: roomName, layerName, file, and optional description, style (JSON: color, opacity, strokeWeight, visible, and attributeDisplay), display (JSON, for rasters). Behavior by content:

  • Point GeoJSON/CSV → markers ({ markersCreated, markers, layer: null })
  • Polygon / line → a vector layer ({ layer: { name, featureCount, ... } })
  • GeoTIFF → a raster layer
  • Larger vector inputs return { jobId } — poll the job (below).
Terminal window
curl -X POST "$API/api/layers/upload" -H "Authorization: Bearer $TOKEN" \
-F "roomName=$ROOM" -F "layerName=my-layer" -F "file=@data/my-layer.geojson"
POST /api/rooms/:roomId/layers (token permission: write)
Content-Type: application/json
{ "name": "drawn", "description": "study area",
"geojson": { "type": "FeatureCollection", "features": [] },
"color": "e11d48", "opacity": 0.35, "strokeWeight": 3, "visible": true }

An optional attributeDisplay field sets the layer’s popup values, raster rows, colors by attribute and filters (below).

PATCH /api/layers/:layerId (token permission: write)
Content-Type: application/json
{ "attributeDisplay": { "version": 1, "popup": { "mode": "auto" } } }

The attribute display says which values a feature’s popup shows, which values of the room’s raster layers it reads under the feature (rasters), how the layer is colored by an attribute, and which range filters the legend offers. The PATCH writes it to the live map and records a timeline entry. It replaces the whole setting, so send every part you want to keep; "attributeDisplay": null removes it. Uploads and inline creates check style.attributeDisplay / attributeDisplay the same way before anything is stored.

A PATCH needs a layer stored on the server (404 otherwise). A layer of 100 features or fewer is kept in the room like a drawn shape, so it takes its attribute display only when it is uploaded, created or imported.

A malformed value is refused, and nothing changes:

{ "error": "invalid_attribute_display",
"details": ["classification.breaks_not_increasing", "classification.colors_length"] }
GET /api/layers/:roomName (token permission: read)

→ { "layers": [ { "id", "name", "featureCount", ... } ] }

GET /api/layers/:layerId/features?minLon=&minLat=&maxLon=&maxLat=&zoom=

Returns a GeoJSON FeatureCollection. Small layers stream a complete object with _metadata.complete = true; very large ones may return a chunk manifest (_metadata.directChunks) whose path values you fetch and merge:

GET /api/layers/:layerId/features/chunks/:chunkIndex
POST /api/layers/upload-chunk (token permission: upload)
POST /api/layers/process-chunked (token permission: upload)

Files over the 50 MB single-request cap are uploaded in chunks (the import script does this for you), then assembled and processed. process-chunked takes the same layerName, description and style as a single upload. A malformed style.attributeDisplay is refused while the uploaded chunks are still kept, so you can fix it and send the same request again.

GET /api/layers/jobs/:jobId

Poll until stage/status is terminal (complete or error):

{ "stage": "processing", "progress": 60, "message": "…" }
DELETE /api/layers/:layerId (user session only)

Deleting a layer is an owner/session operation — a room API token cannot delete layers.