LandXML TIN terrain validation
moon run cmd/main -- check examples/terrain.xml
moon run cmd/main -- check examples/missing-point.xml --format json
moon test --target native
pwsh -NoProfile -File scripts/test-cli.ps1moon run cmd/main -- diff examples/terrain.xml examples/terrain-revised.xml --format jsonmoon run cmd/main -- sample examples/terrain.xml 100.25 200.25 --format jsonmoon run cmd/main -- profile examples/terrain.xml 100.25 199.75 100.25 201.25 --format jsonmoon run cmd/main -- export examples/terrain.xml --format ply --local-origin > terrain.plymoon run cmd/main -- survey examples/terrain.xml examples/survey-points.json 0.1 --format jsonmoon run cmd/main -- contour examples/terrain.xml 10.5 --level 11.5 --format jsonmoon run cmd/main -- volume examples/terrain.xml 11 --format jsonmoon run cmd/main -- rewrite examples/terrain.xml --timestamp 2026-11-21 09:00:00 --project Road > normalized.xmlpub struct Bounds {
min_northing : Double
max_northing : Double
min_easting : Double
max_easting : Double
min_elevation : Double
max_elevation : Double
}pub struct CheckReport {
surfaces : Array[SurfaceSummary]
linear_unit : String?
area_tolerance : Double
strict : Bool
error_count : Int
warning_count : Int
truncated : Bool
record_issues : Array[RecordIssue]
diagnostics : Array[Diagnostic]
}pub struct ContourPath {
surface_number : Int
surface_name : String
elevation : Double
closed : Bool
points : Array[ContourPoint]
}pub struct ContourPoint {
northing : Double
easting : Double
}pub struct ContourReport {
linear_unit : String?
levels : Array[Double]
paths : Array[ContourPath]
skipped_flat_faces : Int
}pub(all) struct Diagnostic {
rule : Rule
surface_number : Int
surface_name : String
face_number : Int?
point_ids : Array[String]
location : SourceLocation?
related_faces : Array[FaceReference]
}pub struct ElevationHit {
surface_number : Int
surface_name : String
face_number : Int
elevation : Double
point_ids : Array[String]
}pub struct ElevationProfile {
length : Double
linear_unit : String?
segments : Array[ProfileSegment]
gaps : Array[ProfileRange]
}pub struct ElevationSample {
northing : Double
easting : Double
linear_unit : String?
hits : Array[ElevationHit]
}pub struct FaceChange {
vertices : Array[String]
before_number : Int
after_number : Int
winding_changed : Bool
visibility_changed : Bool
}pub struct FaceGeometry {
projected_area : Double?
surface_area : Double?
min_grade_percent : Double?
max_grade_percent : Double?
measured_faces : Int
overflow_faces : Int
}pub(all) struct LandXmlMetadata {
date : String?
time : String?
project : String?
description : String?
}pub struct MeshFace {
surface_number : Int
face_number : Int
vertices : (Int, Int, Int)
}pub struct ParsedTerrain {
terrain : Terrain
issues : Array[RecordIssue]
face_numbers : Array[Array[Int]]
}pub(all) struct Point {
id : String
northing : Double
easting : Double
elevation : Double
}pub struct ProfileRange {
start_distance : Double
end_distance : Double
}pub struct ProfileSegment {
surface_number : Int
surface_name : String
face_number : Int
start_distance : Double
end_distance : Double
start_elevation : Double
end_elevation : Double
}pub(all) struct RecordIssue {
surface_number : Int
surface_name : String
code : String
record_kind : String
record_number : Int
message : String
severity : Severity
location : SourceLocation
}pub(all) struct ReferencePlane {
northing : Double
easting : Double
elevation : Double
north_grade : Double
east_grade : Double
}pub(all) enum Rule {
DuplicatePoint
MissingPoint
AmbiguousPoint
NonFinitePoint
RepeatedVertex
DegenerateFace
NonFiniteArea
DuplicateFace
NonManifoldEdge
SharedEdgeDirection
BranchingBoundary
}pub(all) enum Severity {
Error
Warning
}pub struct SourceLocation {
line : Int
column : Int
}pub struct SurfaceComparison {
name : String
status : String
added_point_count : Int
removed_point_count : Int
moved_point_count : Int
added_face_count : Int
removed_face_count : Int
changed_face_count : Int
added_points : Array[String]
removed_points : Array[String]
moved_points : Array[PointChange]
added_faces : Array[Array[String]]
removed_faces : Array[Array[String]]
changed_faces : Array[FaceChange]
truncated : Bool
}pub struct SurfaceSummary {
surface_number : Int
name : String
decoded_points : Int
decoded_faces : Int
invisible_faces : Int
indexed_faces : Int
skipped_visible_faces : Int
usable_points : Int
boundary_edges : Int
boundary_loops : Int
branched_boundaries : Int
connected_components : Int
bounds : Bounds?
geometry : FaceGeometry
}pub(all) struct SurveyPoint {
id : String
northing : Double
easting : Double
elevation : Double
}pub struct SurveyReport {
linear_unit : String?
tolerance : Double
passed_count : Int
outside_tolerance_count : Int
uncovered_count : Int
results : Array[SurveyResult]
}pub struct SurveyResult {
point : SurveyPoint
status : SurveyStatus
hit_count : Int
min_elevation : Double?
max_elevation : Double?
worst_hit : ElevationHit?
max_absolute_error : Double?
}pub(all) enum SurveyStatus {
Passed
OutsideTolerance
Uncovered
}pub struct TerrainComparison {
linear_unit : String?
coordinate_tolerance : Double
surfaces : Array[SurfaceComparison]
}pub struct TerrainMesh {
vertices : Array[MeshVertex]
faces : Array[MeshFace]
linear_unit : String?
origin : MeshVertex
}pub struct VolumeReport {
reference : ReferencePlane
linear_unit : String?
surfaces : Array[VolumeSurface]
cut : Double
fill : Double
}pub struct VolumeSurface {
number : Int
name : String
faces : Int
above_faces : Int
below_faces : Int
crossing_faces : Int
coincident_faces : Int
projected_area : Double
above_area : Double
below_area : Double
cut : Double
fill : Double
}fn build_mesh(terrain : Terrain, surface_name? : String, local_origin? : Bool) -> TerrainMesh raise SamplingErrorfn check(source : String, area_tolerance? : Double, strict? : Bool, max_diagnostics? : Int, max_records? : Int) -> CheckReport raisefn check_survey_points(terrain : Terrain, points : ArrayView[SurveyPoint], tolerance : Double, surface_name? : String) -> SurveyReport raise SamplingErrorfn compare_terrain(before : Terrain, after : Terrain, coordinate_tolerance? : Double, max_details? : Int) -> TerrainComparison raise ComparisonErrorfn elevation_profile(terrain : Terrain, start : (Double, Double), end : (Double, Double), surface_name? : String) -> ElevationProfile raise SamplingErrorfn estimate_volume(terrain : Terrain, reference : ReferencePlane, surface_name? : String) -> VolumeReport raise SamplingErrorfn extract_contours(terrain : Terrain, requested_levels : ArrayView[Double], surface_name? : String, max_segments? : Int) -> ContourReport raise SamplingErrorfn sample_elevation(terrain : Terrain, northing : Double, easting : Double, surface_name? : String) -> ElevationSample raise SamplingErrorfn write_landxml(terrain : Terrain, surface_name? : String, visible_only? : Bool, renumber_points? : Bool, metadata? : LandXmlMetadata) -> String raise