Skip to content

Instantly share code, notes, and snippets.

@sunapi386
Created April 24, 2019 01:52
Show Gist options
  • Save sunapi386/9a9ece302d646ee80a72fc494423a633 to your computer and use it in GitHub Desktop.
Save sunapi386/9a9ece302d646ee80a72fc494423a633 to your computer and use it in GitHub Desktop.
Use PDAL to create a ground surface model from point cloud input
# This is a hjson file, https://hjson.org/
# Linux bash
#GET=https://github.com/hjson/hjson-go/releases/download/v3.0.0/linux_amd64.tar.gz
# macOS bash
#GET=https://github.com/hjson/hjson-go/releases/download/v3.0.0/darwin_amd64.tar.gz
# Install
#curl -sSL $GET | sudo tar -xz -C /usr/local/bin
# Translate to Json
#hjson -j pipeline.hjson > pipeline.json
#pdal pipeline pipeline.json --verbose 8
{
pipeline:
[
# Input
{
# read from our ept server
# up to 0.5m resolutions
# type: readers.ept
# bounds: ([802000, 802500], [2493000, 2493500])
# filename: http://localhost:8080/ept.json
filename: red-rocks.laz
# filename: http://na.entwine.io/red-rocks/ept.json
# resolution: 0.5
}
# {
# # read from our las file
# type: readers.las
# filename: small500-no-outliers.laz
# }
# Filters
{
# adds a classification value of 7 to the noise points
type: filters.outlier
# method: radius
# radius: 1.0
# min_k: 8 # min number of neighbors in radius
method: statistical
mean_k: 8
multiplier: 3
}
{
# voxel-based sampling filter
# reduce the size of the pc
# cell size of 0.2 meters in xyz
type: filters.voxelcenternearestneighbor
cell: 0.1
}
{
# Need to assign point cloud dimension NumberOfReturns 1
# Otherwise: "No returns to process."
type:filters.assign
assignment : NumberOfReturns[0:0]=1
}
{
# Ground classification, ignore the noise points
type: filters.smrf
ignore:Classification[7:7]
}
{
# only allow ground classified points
type: filters.range
limits: Classification[2:2]
}
{
# OPTIONAL
# turn this into a DEM 3D model
# do not use multiple types
# type: filters.delaunay
type: filters.poisson
}
# Output
# # OPTIONAL PLY IF DEM
{
# write to ply
type:writers.ply
filename: red-rocks-smrf-only-poisson.ply
faces:true
storage_mode: default
}
# Output
# {
# # write to laz
# type:writers.las
# filename: red-rocks-ground.laz
# }
]
}
@sunapi386
Copy link
Author

sunapi386 commented Apr 24, 2019

ctmconv red-rocks-smrf-only-delaunay.ply red-rocks-smrf-only-delaunay.stl can convert ply to stl
ctmviewer red-rocks-smrf-only-delaunay.ply visualizes the ply.

sudo apt install openctm-tools

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