qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.34k stars 2.98k forks source link

LAZ file can be opened by QT Reader, but not by QGIS #55589

Closed trockefeller-pathway closed 9 months ago

trockefeller-pathway commented 9 months ago

What is the bug or the crash?

When trying to open an laz file I am getting the error

"Untwine error: Unable to convert scaled value (7615923046) to int32 for dimension 'X' when writing LAS/LAZ file."

A bounding box for the LAZ file is drawn, but it is in the wrong location.

Steps to reproduce the issue

sample.zip

Attached is a sample LAZ file that should be located in Texas with UTM zone 14N 32614

When that file is added to QGIS by dragging and dropping or by Adding a point cloud layer, a bounding box is drawn for the data out in the middle of the ocean.

image

And there is an "Untwine error: Unable to convert scaled value to int32 for dimension 'X' when writing LAS/LAZ file."

When opening the file in Quick Terrain reader there are no errors and the coordinates shown are accurate for where the file should be located in UTM Zone 14N

image

And below are screenshots of the file info as read in by Quick Terrain reader

image image image

The file info says that it's an LAS file, but I'm guessing that Quick Terrain reader decompresses the LAZ file to an LAS file and caches the LAS file in a temporary location while viewing because this was originally opened from the LAZ file that is attached.

I've searched for this problem and I've seen some suggest that if your scaling is very very small that it can cause this kind of problem, but for an LAZ file that covers an area of about 8.5 m by 4.2 m, a scale of 0.1 mm shouldn't be too small to handle appropriately.

Versions

QGIS version 3.34.1-Prizren QGIS code revision 133927424d Qt version 5.15.3 Python version 3.9.5 GDAL/OGR version 3.8.1 PROJ version 9.3.1 EPSG Registry database version v10.098 (2023-11-24) GEOS version 3.12.1-CAPI-1.18.1 SQLite version 3.41.1 PDAL version 2.6.0 PostgreSQL client version unknown SpatiaLite version 5.1.0 QWT version 6.1.6 QScintilla2 version 2.13.4 OS version Windows 10 Version 2009

Active Python plugins quick_map_services 0.19.28 db_manager 0.1.20 grassprovider 2.12.99 MetaSearch 0.3.6 processing 2.12.99

Supported QGIS version

New profile

Additional context

I am generating this LAZ file using a port of laszip to .NET, so if something is missing in the formatting of the file that QGIS needs to process the file correctly, I may be able to adjust things in my file creation process. There may be things assumed by QT Reader that allows it to parse it without issues that are causing problems for the tools used by QGIS.

trockefeller-pathway commented 9 months ago

I kept digging into this issue to try to figure out why my LAZ files couldn't be opened by QGIS, but could be opened by QT Reader, and I found out that I was assigning my min X,Y,Z and max X,Y,Z incorrectly. I was giving the max and min values based on their scaled values instead of their true value after scaling is applied. I guess QT Reader has a fall back to ignore the min and max values if they cause problems and instead recalculate the min and max values from the actual point data. I fixed my LAZ export process and now the data can be read in by QGIS just fine.