pointcloudrasterizers.jl
Process airborne laser scans into raster images
https://github.com/deltares-research/pointcloudrasterizers.jl
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.7%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Process airborne laser scans into raster images
Basic Info
Statistics
- Stars: 14
- Watchers: 10
- Forks: 3
- Open Issues: 1
- Releases: 6
Topics
Metadata Files
README.md
PointCloudRasterizers.jl
Rasterize larger than memory pointclouds
PointCloudRasterizers is a Julia package for creating geographical raster images from larger than memory pointclouds.
Installation
Use the Julia package manager (] in the REPL):
julia
(v1.11) pkg> add PointCloudRasterizers
Usage
Rasterizing pointclouds requires at least two steps:
- index(pc, cellsizes) a pointcloud, returning a PointCloudIndex, linking each point to a cellsizes sized raster cell.
- reduce(pc, f) a PointCloudIndex, creating an output raster by calling f on all points intersecting a given raster cell. f should return a single value.
Optionally one can
- filter(pci, f) the PointCloudIndex, by removing points for which f is false. The function f receives a single point. filter! mutates the PointCloudIndex.
- filter(pci, raster, f) the PointCloudIndex, by removing points for which f is false. The function f receives a single point and the corresponding cell value of raster. raster should have the same size and extents as counts(pci), like a previous result of reduce. filter! mutates the PointCloudIndex.
All three operators iterate once over the pointcloud. While rasterizing thus takes at least two complete iterations, it enables rasterizing larger than memory pointclouds, especially if the provided pointcloud is a lazy iterator itself, such as provided by LazIO.
In the case of a small pointcloud, it can be faster to disable this lazy iteration by calling collect on the LazIO pointcloud first.
Examples
```julia using PointCloudRasterizers using LazIO using GeoArrays using Statistics using GeoFormatTypes using Extents using GeoInterface
Open LAZ file, but can be any GeoInterface support MultiPoint geometry
lazfn = joinpath(dirname(pathof(LazIO)), "..", "test/libLAS_1.2.laz") pointcloud = LazIO.open(lazfn) ```
```julia
Index pointcloud
cellsizes = (1.,1.) # can also use [1.,1.] pci = index(pointcloud, cellsizes)
By default, the bbox and crs of the pointcloud are used
pci = index(pointcloud, cellsizes; bbox=GeoInterface.extent(pointcloud),crs=GeoInterface.crs(pointcloud))
but they can be set manually
pci = index(pointcloud, cellsizes; bbox=Extents.Extent(X=(0, 1), Y=(0, 1)), crs=GeoFormatTypes.EPSG(4326))
or index using the cellsize and bbox of an existing GeoArray ga
pci = index(pointcloud, ga)
index returns a PointCloudIndex
which consists of
the pointcloud the index was calculated from
parent(pci)
GeoArray of point density per cell
counts(pci)
vector of linear indices joining points to cells
index(pci)
For example, one can find the highest recorded point density with
maximum(counts(pci)) ```
The index(pci) is created using LinearIndices, so the index is a single integer value per cell rather than cartesian (X,Y) syntax.
Once an PointCloudIndex is created, users can pass it to the reduce function to convert to a raster.
```julia
Reduce to raster
raster = reduce(pci, reducer=median)
``
The reducer can be functions such asmean,median,lengthbut can also take custom functions. By default theGeoInterface.zfunction is used to retrieve the values to be reduced on. You can provide your own functionop` that returns another value for your points.
```julia
calculate raster of median height using an anonymous function
height_percentile = reduce(pci, op=GeoInterface.z, reducer = x -> quantile(x,0.5)) ``` Any reduced layer is returned as a GeoArray.
One can also filter points matching some condition.
```julia
Filter on last returns (inclusive)
lastreturn(p) = p.returnnumber == p.numberofreturns # custom for LazIO Points
filter!(pci, last_return)
``
Filters are done in-place and create a new index matching the condition. It does not change the loaded dataset. You can also callfilter` which returns a new index, copying the counts and the index, but it does not copy the dataset. This helps with trying out filtering settings without re-indexing the dataset.
Filtering can also be done compared to a computed surface. For example, if we want to select all points within some tolerance of the median raster from above:
julia
within_tol(p, raster_value) = isapprox(p.geometry[3], raster_value, atol=5.0)
filter!(pci, raster, within_tol)
Finally, we can write the raster to disk.
```julia
Save raster to tiff
GeoArrays.write("lastreturnmedian.tif", raster)
Or set some attributes for the tiff file
GeoArrays.write("lastreturnmedian.tif", raster; nodata=-9999, options=Dict("TILED"=>"YES", "COMPRESS"=>"ZSTD")) ```
License
Owner
- Name: Stichting Deltares
- Login: Deltares-research
- Kind: organization
- Email: software.support@deltares.nl
- Location: Netherlands
- Website: https://www.deltares.nl/en/
- Twitter: deltares
- Repositories: 1
- Profile: https://github.com/Deltares-research
Deltares is an independent institute for applied research in the field of water and subsurface.
Citation (CITATION.cff)
cff-version: 1.1.0 message: "If you use this software, please cite it as below." authors: - family-names: Pronk given-names: Maarten orcid: https://orcid.org/0000-0001-8758-3939 title: PointCloudRasterizers.jl version: v0.2.5-zenodo date-released: 2023-10-31
GitHub Events
Total
- Pull request event: 1
- Create event: 1
Last Year
- Pull request event: 1
- Create event: 1
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Maarten Pronk | g****t@e****l | 35 |
| ASUS1 | c****i@y****m | 7 |
| dependabot[bot] | 4****] | 5 |
| Martijn Visser | m****r@g****m | 1 |
| CompatHelper Julia | c****y@j****g | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 8 months ago
All Time
- Total issues: 8
- Total pull requests: 21
- Average time to close issues: over 1 year
- Average time to close pull requests: 3 months
- Total issue authors: 3
- Total pull request authors: 4
- Average comments per issue: 3.88
- Average comments per pull request: 0.52
- Merged pull requests: 12
- Bot issues: 0
- Bot pull requests: 13
Past Year
- Issues: 1
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 9 minutes
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 1.0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Crghilardi (3)
- evetion (2)
- JuliaTagBot (1)
Pull Request Authors
- github-actions[bot] (7)
- dependabot[bot] (5)
- Crghilardi (4)
- evetion (3)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/cache v1 composite
- actions/checkout v2 composite
- julia-actions/julia-buildpkg v1 composite
- julia-actions/julia-runtest v1 composite
- julia-actions/setup-julia v1 composite
- JuliaRegistries/TagBot v1 composite
- actions/checkout v2 composite
- julia-actions/setup-julia latest composite