{
  "$schema": "https://gismap.online/schemas/agent-recipe-v1.schema.json",
  "schemaVersion": 1,
  "id": "lidar-and-3d-models",
  "title": "LiDAR point clouds and 3D models (utility and vegetation data)",
  "status": "experimental",
  "question": "Can an AI agent put a LiDAR point cloud or a CAD model on a shareable 3D map?",
  "answer": "Yes, on the MapLibre engine. A pointcloud layer reads LAS or LAZ (with its CRS) or XYZ text; a model layer reads glTF/GLB, OBJ or PLY placed at an anchor or from projected coordinates. Both draw with three.js on the map and travel in a #map=json: link, colored by RGB, ASPRS class, elevation or intensity, with a class filter for wires, towers and vegetation.",
  "triggers": [
    "Show this LiDAR LAZ file on a map",
    "Show only vegetation and conductor wires from this point cloud",
    "Place this glTF transmission tower model at these coordinates",
    "Put the CAD model of this substation on the map in 3D"
  ],
  "inputTypes": [
    "LAS 1.0–1.4 (point formats 0–10)",
    "LAZ (LASzip)",
    "XYZ / PTS text",
    "glTF / GLB",
    "OBJ",
    "PLY"
  ],
  "inputs": {
    "required": [
      {
        "name": "source",
        "description": "HTTPS URL of the file (the host must allow browser access, CORS), or a local file added in the app."
      }
    ],
    "optional": [
      {
        "name": "crs",
        "description": "EPSG:<code>, proj4 or WKT; needed when the file carries none (XYZ, some LAS, CAD in projected coordinates)."
      },
      {
        "name": "classes",
        "description": "ASPRS classes to show, such as [3, 4, 5] vegetation, [13, 14] wires, [15] towers."
      },
      {
        "name": "colorBy",
        "description": "auto, rgb, classification, elevation or intensity."
      },
      {
        "name": "anchor",
        "description": "Model placement [lon, lat, altitude]; heading, scale and upAxis adjust it."
      },
      {
        "name": "heightReference",
        "description": "ground (default, set on the terrain) or absolute (surveyed elevations)."
      },
      {
        "name": "animate",
        "description": "{ type: \"reveal\" } shows points from low to high on the shared clock."
      }
    ]
  },
  "capabilities": [
    "three-3d",
    "view-3d"
  ],
  "engines": [
    "maplibre"
  ],
  "steps": [
    {
      "stage": "discover",
      "action": "Read llms.txt, this recipe and api/capabilities.json; note the engine and execution environment you actually have.",
      "interfaces": [
        "declarative-url"
      ],
      "references": [
        "https://gismap.online/llms.txt",
        "https://gismap.online/api/capabilities.json",
        "https://gismap.online/api/manifest.json"
      ]
    },
    {
      "stage": "inspect",
      "action": "Check the file type, size and that its host allows browser access. For LAS/LAZ the header gives the point count and usually the CRS; ask for the CRS when it is missing rather than guessing.",
      "interfaces": [
        "declarative-url",
        "standalone-js"
      ],
      "references": [
        "pointcloud-las.js#readLasHeader",
        "pointcloud-las.js#lasCrs"
      ]
    },
    {
      "stage": "plan",
      "action": "Choose colorBy and classes for the question (vegetation encroachment: classes 3–5 with 13–14; structures: 6, 15), a point size, and for models an anchor or the CRS of their coordinates.",
      "interfaces": [
        "declarative-url"
      ],
      "references": [
        "https://gismap.online/schemas/map-v1.schema.json"
      ]
    },
    {
      "stage": "validate",
      "action": "Validate the spec; bad scene3d options are reported and ignored.",
      "interfaces": [
        "standalone-js",
        "in-browser-api"
      ],
      "references": [
        "mapSpec.validate"
      ]
    },
    {
      "stage": "execute",
      "action": "Write #map=json: with layers [{ url, type: \"pointcloud\" | \"model\", scene3d: {...} }], or call layers.add(url, { type, scene3d }) in an open page.",
      "interfaces": [
        "declarative-url",
        "in-browser-api"
      ],
      "references": [
        "mapSpec.createLink",
        "layers.add"
      ]
    },
    {
      "stage": "verify",
      "action": "Open the link on the MapLibre engine: the legend reports points shown of total, CRS and colour mode; tilt the map to see heights.",
      "interfaces": [
        "in-browser-api"
      ],
      "references": [
        "layers.list",
        "mapSpec.fromCurrent"
      ]
    },
    {
      "stage": "share",
      "action": "Return the link. Local files need a project package (.gisx); links only reference public URLs.",
      "interfaces": [
        "declarative-url"
      ],
      "references": [
        "mapSpec.createLink"
      ]
    }
  ],
  "artifact": {
    "type": "map",
    "schema": "https://gismap.online/schemas/map-v1.schema.json",
    "structure": "map-v1 with pointcloud or model layers and their scene3d options."
  },
  "outputs": [
    {
      "format": "Interactive 3D map link",
      "interface": "declarative-url",
      "interactive": true,
      "reference": "mapSpec.createLink"
    },
    {
      "format": "Project with local LiDAR or CAD files (.gisx)",
      "interface": "external-adapter",
      "interactive": true,
      "notes": "Made in the app; local files never go into links."
    }
  ],
  "verification": [
    "Points or model visible where expected on the basemap",
    "Legend: points shown of total, CRS, colour mode",
    "Class filter and colours as requested",
    "Heights plausible when tilted"
  ],
  "limitations": [
    "MapLibre engine only, flat (Mercator) map; the globe and the ArcGIS engine do not draw these layers.",
    "Whole files load into the browser: large clouds are thinned to maxPoints (default 1.5 million). Streaming formats (COPC, EPT, 3D Tiles) are not supported yet.",
    "No point picking, clearance measurement or IFC/DWG/DXF yet; convert CAD to glTF.",
    "LAZ decoding loads laz-perf (WebAssembly) and reprojection loads proj4; unknown EPSG codes are looked up on epsg.io."
  ],
  "recovery": [
    "\"does not say which coordinate system\": add scene3d.crs.",
    "Points in the wrong place: check the CRS and its units (US survey feet vs metres).",
    "Nothing visible: open with ?engine=maplibre and switch off the globe."
  ],
  "examples": [
    {
      "checkedOn": "2026-10-21",
      "checkedVersion": "0.53.0",
      "title": "Autzen Stadium LiDAR (true colour)",
      "prompt": "Show this LAS file on a 3D map: https://raw.githubusercontent.com/PDAL/PDAL/master/test/data/las/autzen_trim.las",
      "dataset": [
        {
          "label": "PDAL sample LiDAR: Autzen Stadium, Eugene, Oregon (LAS 1.2, RGB)",
          "url": "https://raw.githubusercontent.com/PDAL/PDAL/master/test/data/las/autzen_trim.las"
        }
      ],
      "url": "https://gismap.online/#map=json:%7B%22version%22%3A1%2C%22title%22%3A%22Autzen%20Stadium%20LiDAR%22%2C%22basemap%22%3A%22gray-vector%22%2C%22legend%22%3Atrue%2C%22layers%22%3A%5B%7B%22url%22%3A%22https%3A%2F%2Fraw.githubusercontent.com%2FPDAL%2FPDAL%2Fmaster%2Ftest%2Fdata%2Flas%2Fautzen_trim.las%22%2C%22type%22%3A%22pointcloud%22%2C%22title%22%3A%22Autzen%20Stadium%20LiDAR%20(PDAL%20sample)%22%2C%22scene3d%22%3A%7B%22colorBy%22%3A%22rgb%22%2C%22pointSize%22%3A2%7D%7D%5D%7D",
      "spec": {
        "version": 1,
        "title": "Autzen Stadium LiDAR",
        "basemap": "gray-vector",
        "legend": true,
        "layers": [
          {
            "url": "https://raw.githubusercontent.com/PDAL/PDAL/master/test/data/las/autzen_trim.las",
            "type": "pointcloud",
            "title": "Autzen Stadium LiDAR (PDAL sample)",
            "scene3d": {
              "colorBy": "rgb",
              "pointSize": 2
            }
          }
        ]
      },
      "status": "rendered",
      "checks": [
        "Opened headless from this branch (local server): 110,000 points reprojected from the file's WKT (Oregon Lambert, international feet) to Eugene, Oregon; true-colour trees and ground visible when tilted (screenshot inspected).",
        "Placed on the terrain at the cloud's ground level."
      ]
    },
    {
      "checkedOn": "2026-10-21",
      "checkedVersion": "0.53.0",
      "title": "Ground returns only, revealed by height",
      "prompt": "Show only the ground points, coloured by elevation, and animate them.",
      "dataset": [
        {
          "label": "PDAL sample LiDAR: Autzen Stadium, Eugene, Oregon (LAS 1.2, RGB)",
          "url": "https://raw.githubusercontent.com/PDAL/PDAL/master/test/data/las/autzen_trim.las"
        }
      ],
      "url": "https://gismap.online/#map=json:%7B%22version%22%3A1%2C%22title%22%3A%22Autzen%20ground%20surface%22%2C%22basemap%22%3A%22gray-vector%22%2C%22legend%22%3Atrue%2C%22layers%22%3A%5B%7B%22url%22%3A%22https%3A%2F%2Fraw.githubusercontent.com%2FPDAL%2FPDAL%2Fmaster%2Ftest%2Fdata%2Flas%2Fautzen_trim.las%22%2C%22type%22%3A%22pointcloud%22%2C%22title%22%3A%22Ground%20returns%20(class%202)%22%2C%22scene3d%22%3A%7B%22classes%22%3A%5B2%5D%2C%22colorBy%22%3A%22elevation%22%2C%22pointSize%22%3A3%2C%22animate%22%3A%7B%22type%22%3A%22reveal%22%2C%22durationMs%22%3A6000%2C%22loop%22%3Atrue%7D%7D%7D%5D%7D",
      "spec": {
        "version": 1,
        "title": "Autzen ground surface",
        "basemap": "gray-vector",
        "legend": true,
        "layers": [
          {
            "url": "https://raw.githubusercontent.com/PDAL/PDAL/master/test/data/las/autzen_trim.las",
            "type": "pointcloud",
            "title": "Ground returns (class 2)",
            "scene3d": {
              "classes": [
                2
              ],
              "colorBy": "elevation",
              "pointSize": 3,
              "animate": {
                "type": "reveal",
                "durationMs": 6000,
                "loop": true
              }
            }
          }
        ]
      },
      "status": "loaded",
      "checks": [
        "Loaded through layers.add with classes [2] and the reveal animation running on the shared clock (mid-reveal screenshot).",
        "This sample has only unclassified and ground classes; vegetation and wire classes need a classified utility survey."
      ]
    }
  ],
  "lastTestedVersion": "0.53.0",
  "resultStatuses": [
    "prepared",
    "validated",
    "loaded",
    "rendered",
    "verified",
    "partial",
    "failed"
  ]
}
