Comments (6)
@Fri-end I haven't dug into this in any depth, but you should be able to get the reported offset (and other info) as follows:
import laspy
import numpy as np
f = laspy.file.File("./960.las")
print(f.header.vlrs[1].extra_dimensions[0].description)
print(f.header.vlrs[1].extra_dimensions[0].name)
print(f.header.vlrs[1].extra_dimensions[0].scale)
print(f.header.vlrs[1].extra_dimensions[0].offset)
from laspy.
To me it seems like you get the correct values, it is just not what you are expecting. The extra bytes values you are seeing are unscaled. Extra bytes support in laspy is not very advanced so you'll have apply an offset and scaling factor yourself.
That info seems to be available in a Extra Byte Variable Length Record that follows the LAS1.4 spec, even though the file is LAS1.2. Laspy reads the name of the dimension from it, but at the moment it doesn't apply the offset and scaling values.
from laspy.
The file was created with lasheight
. The scaling factors are mentioned in the README. I'd start by reading that carefully. If you know with which paramters lasheight
was called you should be able to figure out how the data should be scaled properly.
from laspy.
@kbevers Thanks for this suggestion, I did manage to properly scale heights above ground using the offset of 25000 and scale of 0.01. However, I used a proprietary software to find these values. I was hoping to be able to access this information using LasPy's in-built functionality. Unfortunately, after running
print inFile.header.vlrs[1].scale
print inFile.header.vlrs[1].offset
I'm getting errors:
AttributeError: VLR instance has no attribute 'scale'
AttributeError: VLR instance has no attribute 'offset'
from laspy.
I don't think laspy's VLR capabilities are that advanced yet. Ideally laspy would scale the values for you. If this is an important feature for you, I suggest you implement it yourself and submit the changes in a PR. I'm happy to merge any improvements.
from laspy.
@grantbrown Thanks for this suggestion. It works like a charm!
@kbevers If I find time to add functionality to automatically scale 'extra_bytes' fields at some point, I will send a pull request. Thanks again!
from laspy.
Related Issues (20)
- Reclassification of a COPC file HOT 5
- Allow for writing a custom creation date HOT 1
- append_points() function has size limit at approximately 15.1GB? HOT 3
- Ability to read COPC from fsspec sources HOT 2
- LAS/LAZ Header from Remote Source HOT 2
- laszip installation in ubuntu HOT 2
- Append data points to existing LAS file with header that contains extra dimensions. HOT 5
- List of 0 issue HOT 3
- Tests fail: ModuleNotFoundError: No module named 'laspy.cli.core' HOT 11
- laspy installs the 'tests' module globally that would conflict with other packages that accidentally do the same
- The 'rich' dependency is not listed in setup.py HOT 1
- Header update API? HOT 1
- AttributeError: module 'laspy' has no attribute 'read' HOT 7
- Provide pre-built wheels HOT 4
- Conda Forge test failures with Numpy 1.22 + Python 3.9 HOT 6
- Multiple point clouds structure in one LAS file HOT 2
- LAS / LAZ Shuffle in custom attributes in QGIS HOT 7
- Empty string input parse_crs() should result in a None return, but instead a CRSError is thrown in pyproj HOT 1
- 'scales' behave weirdly, dont really scale anything but round point coordinates? possibly reducing accuracy without warning
- Laspy errors on Windows 10 - permission denied HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laspy.