Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use laszip4j to modify a lidar file content? #117

Open
gwlucastrig opened this issue Jan 16, 2024 · 2 comments
Open

Can I use laszip4j to modify a lidar file content? #117

gwlucastrig opened this issue Jan 16, 2024 · 2 comments

Comments

@gwlucastrig
Copy link

I have Java code that processes a lidar file and identifies anomalous sample points. I would like to be able to transcribe an existing file content, either removing the anomalous records or marking them as "withheld". I am also working on the ability to classify points.

Is there way to use laszip4j to handle the writing operations? If so, is there example code or documentation in the repository?

Ideally, I would like to be able to preserve header elements and other data such as VLR's so that I had a viable output file at the end of the process.

Thanks.

P.S. Sorry to have used a Github Issue to convey what is really just a question, but I didn't see any alternate means of contact.

@mreutegg
Copy link
Owner

Write capabilities of laszip4j are currently a bit limited. Re-classifying points is possible. See the following lines in LASWriterTest.

LASReader reader = new LASReader(files.las).transform((point, modifier) -> {
if (point.getClassification() == lowPoint) {
modifier.setClassification(unclassified);
numModified.incrementAndGet();
}
});
LASWriter writer = new LASWriter(reader);
writer.write(outputFile);

You basically read points, transform them (e.g. change the classification of a point) and write them back to another file.

As you can see in https://github.com/mreutegg/laszip4j/blob/98d8d821ca0c67ef0114af7555012632afdab805/src/main/java/com/github/mreutegg/laszip4j/LASPointModifier.java it currently only allows setting the classification.

I added support for updating the withheld flag in #118

Would this work for you?

@mreutegg
Copy link
Owner

PR #118 is now merged and included in laszip4j 0.18. I'll keep this issue open, because laszip4j still does not have general support for modifying point data.

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

No branches or pull requests

2 participants