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

writeLAS version selection? #319

Closed
jgrn307 opened this issue Feb 6, 2020 · 3 comments
Closed

writeLAS version selection? #319

jgrn307 opened this issue Feb 6, 2020 · 3 comments
Assignees
Labels
Question Not an issue, just a question

Comments

@jgrn307
Copy link

jgrn307 commented Feb 6, 2020

So I'm trying to visualize some data in the Mac version of cloudcompare which, unfortunately, only works with LAS 1.2 and below. Is there any way to control writeLAS to select the LAS version I want (I assume it is defaulting to 1.4)?

@Jean-Romain Jean-Romain self-assigned this Feb 6, 2020
@Jean-Romain Jean-Romain added the Question Not an issue, just a question label Feb 6, 2020
@Jean-Romain
Copy link
Collaborator

Jean-Romain commented Feb 6, 2020

Please provide a reproducible example. writeLAS() does not have defaulting mode. It writes the format of the LAS object which is the format of the original file read with readLAS(). If you created a LAS object with LAS() without providing any header the format is likely to be 1.2

You can modify the format manually changing the header but if your LAS object is really a LAS 1.4 you could not easily write it in a LAS 1.2 without making other changes.

las@header@PHB[["Version Minor"]] = 2L

Normally I no longer answer to questions about lidR by email or on github because I receive too many questions from too many users. If you have questions about using the lidR package please ask on gis.stackexchange.com with the tag lidr. On stackexchange.com other users can also answer your questions and the answers thus provided will be public and well indexed by search engines so they can also help others users.

If you believed you found a bug please provide a reproducible example.

@jgrn307
Copy link
Author

jgrn307 commented Feb 6, 2020

Sorry, the input is definitely a las 1.4 file -- this isn't a bug so much as a feature request -- add some ability to set LAS formats in writeLAS. There's a reasonable number of external programs out there that can get grumpy with 1.4. CloudCompare is an excellent visualization system, but on a Mac it it using an older verison of libLAS so there's no way to open a 1.4 file.

@Jean-Romain
Copy link
Collaborator

las2las from LAStools is a free and open source tools that can convert your 1.4 into 1.2 (and the opposite) much efficiently that what could be done in R. See this question. I don't see any incentive at making a copy of existing tools in less good. However you can convert manually in R if you really want to. Try something like:

las@header@PHB[["Version Minor"]] = 2L
las@header@PHB[["Point Data Format ID"]] = 2 # Choose which prf fits with your data
las@data[["ScanAngleRank"]] <- as.integer(las@data[["ScanAngle"]]) # If prf >= 6

If you need more details please ask on gis.stackexchange and provide more information about your 1.4 data.

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Not an issue, just a question
Projects
None yet
Development

No branches or pull requests

2 participants