Skip to content

Commit

Permalink
use change_scaling method to change scales
Browse files Browse the repository at this point in the history
Changing the header scales directly worked until laspy 2.1.0.
In 2.1.0 the header scales and the scales of the points object
of type `ScaleAwarePointRecord` would get out of sync
when not using `change_scaling`.
That method exists since laspy 2.0.0, so there should
be no breaking change
  • Loading branch information
davidcaron committed Jan 18, 2022
1 parent 0891051 commit 3b3701f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/jaklas/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ def write(

min_ += xyz_offset
max_ += xyz_offset
las.header.mins, las.header.maxs, las.header.offsets = min_, max_, offset
las.header.scales = scale if scale else _get_scale(min_, max_, offset)
las.header.mins, las.header.maxs = min_, max_
scales = scale if scale else _get_scale(min_, max_, offset)
las.change_scaling(scales=scales, offsets=offset)

las.x = xyz[0].astype("d") + xyz_offset[0]
las.y = xyz[1].astype("d") + xyz_offset[1]
Expand Down

0 comments on commit 3b3701f

Please sign in to comment.