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

Default Int32 coordinates type overflow issue #32

Closed
zjans opened this issue Oct 10, 2022 · 2 comments
Closed

Default Int32 coordinates type overflow issue #32

zjans opened this issue Oct 10, 2022 · 2 comments

Comments

@zjans
Copy link

zjans commented Oct 10, 2022

The default data type for X/Y coordinates leads to an integer overflow in some cases.
For some datasets, the projected coordinates are scaled by a factor, and they don't fit into Int32.

Would it be possible to add a check and change the type accordingly?

@evetion
Copy link
Owner

evetion commented Oct 11, 2022

Thanks for creating an issue! Can you describe exactly (i.e. with code) what you're trying to do?

LAS/LAZ files store the coordinates as offsetted and scaled Int32. So on writing (if that's what you're trying to do), we can't change the type, but have to change the offset and/or scale.

At the moment, when reading you have to do the inverse operations yourself, (so .X * scale + offset) to get the correct floating point coordinate back.

@zjans
Copy link
Author

zjans commented Oct 11, 2022

Of course! Thanks, that fixed it. I'm working with two different datasets which should've been scaled in the same way – but aren't. The header included the correct scale+offset.

@zjans zjans closed this as completed Oct 11, 2022
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