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), 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 }
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.

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.