Giter VIP home page Giter VIP logo

Comments (6)

grantbrown avatar grantbrown commented on July 20, 2024 2

@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.

kbevers avatar kbevers commented on July 20, 2024

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.

kbevers avatar kbevers commented on July 20, 2024

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.

yurithefury avatar yurithefury commented on July 20, 2024

@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.

kbevers avatar kbevers commented on July 20, 2024

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.

yurithefury avatar yurithefury commented on July 20, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.