Skip to content

Write LAS 1.4 with point formats 6 to 8, scale, offset and coordinate system - #73

Open
mahach666 wants to merge 2 commits into
feature/issue-21-edgewise-scalefrom
feature/issue-22-las-exporter
Open

mahach666 wants to merge 2 commits into
feature/issue-21-edgewise-scalefrom
feature/issue-22-las-exporter

Conversation

@mahach666

Copy link
Copy Markdown
Contributor

Closes #22

Based on #72 (the branch feature/issue-21-edgewise-scale); merge the earlier pull requests first.

What changed

  • The LAS exporter now writes 1.4 with point formats 6 to 8, selected by the new PclLasOptions: version (1.2/1.4),
    point format (2 for 1.2; 6/7/8 for 1.4, where 7 adds RGB and 8 adds a zero near infrared), a configurable scale
    (default 1 mm) and offset (default the minimum of the data), and an optional GeoTIFF coordinate system record
    transcribed from an EPSG:NNNN source coordinate system. Mismatched version/format pairs are rejected.
  • 1.4 headers carry the 64-bit point count and the 15 return counts; legacy fields mirror the count when it fits.
    Record layout follows the standard (return 1 of 1, full-byte classification, zero GPS time/source/scan angle).
  • 1.2 with point format 2 and default options is byte-identical to before (all existing byte-level tests pass unchanged).
  • The offset is validated together with the extent, so an offset the coordinates do not fit now fails with
    NotSupportedException instead of overflowing.

Files changed

  • src/PclIO/Export/PclLasOptions.cs: new LasVersion enum and PclLasOptions record (validated init).
  • src/PclIO/Export/PclLasExporter.cs: versioned headers (227/375 bytes), per-format records, VLR writing, new overloads.
  • tests/PclIO.Tests/ExportTests.cs: header/version/format/scale/offset/count/CRS assertions, a full 1.4 round trip that
    decodes the written records, format 6/8 specifics, mismatch and validation tests, overflow-guard test.
  • tests/PclIO.Tests/OptionsAndPathTests.cs: defaults and validation of the new options.
  • README.md, docs/getting-started.md, docs/public-api.md, CHANGELOG.md: the new behaviour.

Tests

  • dotnet build — 0 warnings, 0 errors.
  • dotnet test — 686 passed, 0 failed, 10 skipped (the tests that need private scan files) on .NET 8 and .NET 10.

Limits

  • No PclFile-level round trip yet: reading the output back through PclFile.Open needs the LAS reader of issue Format: LAS (*.las) #25.
    The round trip here parses and decodes the written bytes field by field instead.
  • The coordinate system record transcribes only the EPSG:<1..65535> form as a projected GeoTIFF reference; anything else
    (geographic codes included) is skipped without a record, which is documented. Non-EPSG names never produce a record.
  • The CLI still writes LAS 1.2 format 2 (no new flags); 1.4 is a library option.
  • GPS time, point source id and scan angle are written as zero; NIR is always zero (points carry none).

@mahach666
mahach666 force-pushed the feature/issue-21-edgewise-scale branch from c88b0e4 to a5f96ab Compare November 17, 2026 15:02
@mahach666
mahach666 force-pushed the feature/issue-22-las-exporter branch from d93b040 to 4e9bf94 Compare November 17, 2026 15:02

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant