Comments (7)
Here is a function to easily reproduce the issue:
def reproduct_issue(path: Path) -> None:
header = laspy.LasHeader(point_format=3, version="1.4")
las = laspy.LasData(header)
las.add_extra_dims(
[
laspy.ExtraBytesParams(name="b", type=np.float64),
laspy.ExtraBytesParams(name="bx", type=np.float64),
laspy.ExtraBytesParams(name="by", type=np.float64),
laspy.ExtraBytesParams(name="bz", type=np.float64),
],
)
las.x = np.linspace(0, 100, 100)
las.y = np.linspace(0, 100, 100)
las.z = np.linspace(0, 100, 100)
las.b = np.full(100, 0, dtype=np.float64)
las.bx = np.full(100, 1, dtype=np.float64)
las.by = np.full(100, 2, dtype=np.float64)
las.bz = np.full(100, 3, dtype=np.float64)
las.write(str(path), laz_backend=laspy.LazBackend.LazrsParallel)
I'm using laspy 2.5.3 and Qgis LTS 3.34.5 to open the exported file.
If you open the exported file, you will see that the additional fileds do not have the expected value.
from laspy.
Using the following example script to create a file and then running it through Untwine@hobuinc/untwine@255d30b, I do not see any mix ups in the data values and their extra_bytes definitions.
import laspy
import numpy as np
# 0. Creating some dummy data
my_data_xx, my_data_yy = np.meshgrid(np.linspace(-20, 20, 15), np.linspace(-20, 20, 15))
my_data_zz = my_data_xx ** 2 + 0.25 * my_data_yy ** 2
my_data = np.hstack((my_data_xx.reshape((-1, 1)), my_data_yy.reshape((-1, 1)), my_data_zz.reshape((-1, 1))))
# 1. Create a new header
import pyproj
header = laspy.LasHeader(point_format=6, version="1.4")
header.add_crs(pyproj.CRS("EPSG:4326"))
header.add_extra_dim(laspy.ExtraBytesParams(name="random24", type=np.int32))
header.add_extra_dim(laspy.ExtraBytesParams(name="random42", type=np.int32))
header.add_extra_dim(laspy.ExtraBytesParams(name="random24f", type=np.float64))
header.add_extra_dim(laspy.ExtraBytesParams(name="random42f", type=np.float64))
header.offsets = np.min(my_data, axis=0)
header.scales = np.array([0.1, 0.1, 0.1])
# 2. Create a Las
las = laspy.LasData(header)
las.x = my_data[:, 0]
las.y = my_data[:, 1]
las.z = my_data[:, 2]
las.random42 = np.full(len(las.points), 42, np.int32)
las.random24 = np.full(len(las.points), 24, np.int32)
las.random42f = np.full(len(las.points), 42.0, np.float64)
las.random24f = np.full(len(las.points), 24.0, np.float64)
las.write("new_file.las")
from laspy.
I don't understand what you mean by 'shuffle'.
from laspy.
I am using laspy to display magnetic survey by drone. On each point I have custom attributes "b", "bx", "by", "bz"
But once processed trought laspy, on QGIS, all "bz" values will be in "by" insteed.
Here is the script used that is shuffle values:
def write_mag(path: Path, data: npt.NDArray[np.float_], epsg_proj: int) -> None:
header = laspy.LasHeader(point_format=3, version="1.4")
header.add_crs(pyproj.CRS(f"EPSG:{epsg_proj}"))
las = laspy.LasData(header)
las.add_extra_dims(
[
laspy.ExtraBytesParams(name="bx", type=data["bx"].dtype),
laspy.ExtraBytesParams(name="by", type=data["by"].dtype),
laspy.ExtraBytesParams(name="bz", type=data["bz"].dtype),
laspy.ExtraBytesParams(name="b", type=data["b"].dtype),
],
)
las.x = data["x"]
las.y = data["y"]
las.z = data["z"]
las.bx = data["bx"]
las.by = data["by"]
las.bz = data["bz"]
las.b = data["b"]
las.write(str(path), laz_backend=laspy.LazBackend.LazrsParallel)
logger.info("Wrote LAS file to %s", path)
Values are "f8" numpy types.
from laspy.
So is this a QGIS ticket or a laspy ticket?
from laspy.
This is both as I don t know where the problem come from...
qgis/QGIS#56942
from laspy.
Yes, after more investigation it seems laspy is doing a great job. But QGIS doesn't.
This software will create a .copc.laz file where the attributes will shuffles...
from laspy.
Related Issues (20)
- Appending points to a LasData object HOT 1
- migrate to urllib3 2.0 HOT 2
- Classification in laspy doesn't match with lasinfo HOT 6
- 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
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.