Aner LiDAR
Read local LAS point clouds, filter classified returns, summarize elevations on a grid, and export native 3D and coverage charts.
Development APIsaner.lidar opens local LAS point clouds and computes elevation summaries with bounded CPU memory. Pass a selection directly to aner.plot for an interactive 3D review, or pass its grid to draw the number of returns in each cell. Both charts use the same window, class and quality filters.
Development availability. Use a matching Aner 0.1.1 development runtime with LiDAR support. The example uses uncompressed LAS 1.4 point format 6. The reader also accepts uncompressed point formats 7 and 8. ASPRS LAS 1.4 specification
Run the watershed example
Download the Aner program and synthetic LAS file into the same directory. The coordinates, classification and intensity values are invented. The fixture uses NAD83 / UTM zone 13N for horizontal coordinates and NAVD88 for elevations, in metres. Watershed example page
From that directory, check the source and run it in development mode. Use a fresh working directory for each run, since Aner preserves existing reports and exports.
aner check lidar_watershed.aner
aner lidar_watershed.aner --dev lidar-firstOpen lidar-first/inspection.html to inspect the LAS metadata, number of selected returns, elevation grid and a deliberately empty cell captured by dev.capture. The terminal prints the source metadata and the grid summary. The program writes watershed-review.html, watershed-points.svg and watershed-coverage.svg. Run with --prod for the same analysis and plot exports without the inspection report. Development and production modes
Select ground returns and build a grid
Check the coordinate reference information before choosing a window or labeling axes. window takes (xmin, ymin, xmax, ymax) in source coordinates. Lower bounds are inclusive and upper bounds are exclusive. Classification 2 selects returns marked as ground by the source. The withheld flag can exclude returns independently of class. USGS LiDAR classification
import aner.lidar
import aner.parallel
import aner.plot
let work = lidar.context_with(execution: parallel.local(workers: 4), memory_mb: 32)
let cloud = lidar.open(work, "lidar_watershed.las")
let ground = cloud.window(500000.0, 4420000.0, 500120.0, 4420100.0)
.where_class(2, include_withheld: false)
let elevation = ground.grid(cell_size: 10.0)
print(elevation.summary())The example selects 616 of 710 returns and produces a grid of 12 columns by 10 rows. The grid starts at the window's southwest corner with zero based columns going east and rows going north. The statistic for each occupied cell is the minimum, maximum or mean elevation of its ground classified returns. A bare earth DEM requires a separate surface method and validation. USGS elevation model surface treatment
Review the cloud in standalone HTML
Pass the selection to plot.point_cloud and choose how many returns to draw. Color by elevation with "z" or by the raw intensity stored in the source with "intensity". The fixed seed gives the same sample for the same source and selection.
let points = plot.point_cloud(ground, color: "z", max_points: 300, seed: 42)
.labels("Easting (m)", "Northing (m)", "NAVD88 elevation (m)")
.color_label("Elevation (m)").aspect("equal").view(-48.0, 30.0).view_zoom(1.65)
points.show()
points.save("watershed-review.html")Open the native watershed dashboard. Rotate the plot, switch to an orthogonal view or inspect individual sampled returns in the table. The HTML embeds the initial chart, sample and viewer, so the exported review opens offline. The figure below is the initial view. Aner Plot offline 3D controls
Check spatial coverage
plot.lidar_grid(elevation) draws the count of all selected returns in each cell. The six empty cells have count zero and no elevation statistic. Use elevation.cell_count(column, row) before asking for a cell mean. For example, cell (2, 2) is empty and cell (0, 0) contains three returns. Use the coverage chart to identify gaps before interpreting local elevation.
let coverage = plot.lidar_grid(elevation)
.labels("Easting (m)", "Northing (m)")
coverage.show()
coverage.save("watershed-coverage.svg")The charts retain analysis metadata in chart.provenance() and in native exports. It identifies the selected count, source point format, window, classification, and withheld policy. The preview also records its seed and displayed count.
Coordinate and execution limits
- LAS stores integer XYZ with an offset and scale for each axis. The reader computes physical coordinates in Float64 and retains the file's coordinate system metadata. The grid uses planar arithmetic in the source XY units. Verify a projected horizontal CRS and confirm the elevation datum and unit before interpreting distances, areas or heights. Aner geographic types
- Local LAS processing streams bounded batches and can use the local CPU executor. The memory budget covers each operation's scan buffers and grid or sample. Rendering has its own limits. The grid and point preview each traverse the selection, and a small window on an unindexed file can still require a full scan. Keep the input file fixed during analysis.
- LAZ decompression, COPC range reads, coordinate transformations, distributed tile execution, spatial clustering and GPU kernels are future work.
API at a glance
| Call | Result |
|---|---|
lidar.context(memory_mb: 32), lidar.context_with(execution: workers, memory_mb: 32) | A serial or local parallel context with a managed memory budget in MiB. |
lidar.open(work, path), cloud.metadata() | An immutable LAS source and its metadata summary. |
cloud.source_count(), cloud.crs_wkt() | Header point count and coordinate reference text. Missing coordinate reference text returns an empty String. |
cloud.window(xmin, ymin, xmax, ymax), selection.where_class(2, include_withheld: false) | An immutable selection by XY bounds and classification. |
selection.grid(cell_size: 10.0) | A grid with counts and elevation statistics. |
grid.count(), grid.columns(), grid.rows() | Total selected returns, grid width and grid height. |
grid.counts(), grid.peak_workers() | Row major counts for at most 10,000 cells and the peak number of workers used by the scan. |
grid.cell_count(column, row), grid.cell_min(column, row), grid.cell_max(column, row), grid.cell_mean(column, row) | Counts and statistics for one cell. Check for a nonzero count before reading elevation statistics. |
plot.point_cloud(selection, color: "z", max_points: 300, seed: 42) | A 3D scatter chart with a deterministic sample of up to 10,000 returns. |
plot.lidar_grid(grid) | A native coverage chart with up to 10,000 cells and zero counts retained. |
See the complete callable index for the native module and method name catalogue.