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.52k stars 2.99k forks source link

Unable to view LAS files written in WGS84 (EPSG:4326) coordinates. #44755

Closed ATL-Flaneur closed 3 years ago

ATL-Flaneur commented 3 years ago

What is the bug or the crash?

I'm processing lidar data and need to work in WGS84 coordinates. This includes storing intermediate results in LAZ files with WGS84 as the CRS. QGIS seems unable to display LPC data in this format. The bounding box displays but not the data, which appears to render at the lat/lon of the integer representation of the data vs. the scaled lat/lon values.

The archive files.tgz contains an example source file, PDAL pipeline, and WGS84 output file:

{
  "pipeline": [
    "nc_tile_0793_016_spm.laz",
    {
      "type": "filters.reprojection",
      "out_srs": "EPSG:4326"
    },
    {
      "filename": "sd_coord_test.laz",
      "type": "writers.las",
      "compression": "laszip",
      "extra_dims": "all",
      "scale_x": "1e-7",
      "scale_y": "1e-7",
      "scale_z": "1e-6"
    }
  ]
}

Steps to reproduce the issue

  1. Download and unpack files.tgz
  2. Load nc_tile_0793_016_spm.laz into QGIS. Everything works great.
  3. Load sd_coord_test.laz, which is a transformed version of the above files, and the file does not display at all, statistics/layers are unavailable, etc.
  4. Run "pdal info sd_coord_test.laz", everything goes well, indicating that the file is okay:
ayank@snorri lpc % pdal info sd_coord_test.laz 
{
  "file_size": 9363207,
  "filename": "sd_coord_test.laz",
  "now": "2021-08-19T13:48:37-0400",
  "pdal_version": "2.2.0 (git-version: Release)",
  "reader": "readers.las",
  "stats":
  {
    "bbox":
    {
      "EPSG:4326":
      {
        "bbox":
        {
          "maxx": -78.662898,
          "maxy": 35.7690706,
          "maxz": 718.63,
          "minx": -78.6713529,
          "miny": 35.76218,
          "minz": 54.75
        },
        "boundary": { "type": "Polygon", "coordinates": [ [ [ -78.6713529, 35.76218, 54.75 ], [ -78.6713529, 35.7690706, 54.75 ], [ -78.662898, 35.7690706, 718.63 ], [ -78.662898, 35.76218, 718.63 ], [ -78.6713529, 35.76218, 54.75 ] ] ] }
      },
      "native":
      {
        "bbox":
        {
          "maxx": -78.662898,
          "maxy": 35.7690706,
          "maxz": 718.63,
          "minx": -78.6713529,
          "miny": 35.76218,
          "minz": 54.75
        },
        "boundary": { "type": "Polygon", "coordinates": [ [ [ -78.6713529, 35.76218, 54.75 ], [ -78.6713529, 35.7690706, 54.75 ], [ -78.662898, 35.7690706, 718.63 ], [ -78.662898, 35.76218, 718.63 ], [ -78.6713529, 35.76218, 54.75 ] ] ] }
      }
    },
    "statistic":
    [
      {
        "average": -78.66686271,
        "count": 1745877,
        "maximum": -78.662898,
        "minimum": -78.6713529,
        "name": "X",
        "position": 0,
        "stddev": 0.002282364855,
        "variance": 5.209189332e-06
      },
      {
        "average": 35.76554162,
        "count": 1745877,
        "maximum": 35.7690706,
        "minimum": 35.76218,
        "name": "Y",
        "position": 1,
        "stddev": 0.001894230006,
        "variance": 3.588107316e-06
      },
      {
        "average": 97.99420093,
        "count": 1745877,
        "maximum": 718.63,
        "minimum": 54.75,
        "name": "Z",
        "position": 2,
        "stddev": 10.84928857,
        "variance": 117.7070626
      },
      {
        "average": 29.56497565,
        "count": 1745877,
        "maximum": 255,
        "minimum": 0,
        "name": "Intensity",
        "position": 3,
        "stddev": 20.29899318,
        "variance": 412.049124
      },
      {
        "average": 1.26050747,
        "count": 1745877,
        "maximum": 5,
        "minimum": 1,
        "name": "ReturnNumber",
        "position": 4,
        "stddev": 0.518279195,
        "variance": 0.268613324
      },
      {
        "average": 1.520816759,
        "count": 1745877,
        "maximum": 5,
        "minimum": 1,
        "name": "NumberOfReturns",
        "position": 5,
        "stddev": 0.6909229391,
        "variance": 0.4773745078
      },
      {
        "average": 0.5075013876,
        "count": 1745877,
        "maximum": 1,
        "minimum": 0,
        "name": "ScanDirectionFlag",
        "position": 6,
        "stddev": 0.4999438692,
        "variance": 0.2499438723
      },
      {
        "average": 0.0006214641696,
        "count": 1745877,
        "maximum": 1,
        "minimum": 0,
        "name": "EdgeOfFlightLine",
        "position": 7,
        "stddev": 0.02492144273,
        "variance": 0.0006210783076
      },
      {
        "average": 6.157404559,
        "count": 1745877,
        "maximum": 11,
        "minimum": 1,
        "name": "Classification",
        "position": 8,
        "stddev": 4.699674113,
        "variance": 22.08693676
      },
      {
        "average": 13.57462811,
        "count": 1745877,
        "maximum": 20,
        "minimum": 3,
        "name": "ScanAngleRank",
        "position": 9,
        "stddev": 3.717360234,
        "variance": 13.81876711
      },
      {
        "average": 0,
        "count": 1745877,
        "maximum": 0,
        "minimum": 0,
        "name": "UserData",
        "position": 10,
        "stddev": 0,
        "variance": 0
      },
      {
        "average": 203.5207967,
        "count": 1745877,
        "maximum": 204,
        "minimum": 203,
        "name": "PointSourceId",
        "position": 11,
        "stddev": 0.4995674526,
        "variance": 0.2495676397
      },
      {
        "average": 0,
        "count": 1745877,
        "maximum": 0,
        "minimum": 0,
        "name": "Red",
        "position": 12,
        "stddev": 0,
        "variance": 0
      },
      {
        "average": 0,
        "count": 1745877,
        "maximum": 0,
        "minimum": 0,
        "name": "Green",
        "position": 13,
        "stddev": 0,
        "variance": 0
      },
      {
        "average": 0,
        "count": 1745877,
        "maximum": 0,
        "minimum": 0,
        "name": "Blue",
        "position": 14,
        "stddev": 0,
        "variance": 0
      },
      {
        "average": 45516603.04,
        "count": 1745877,
        "maximum": 45517177.09,
        "minimum": 45515981.28,
        "name": "GpsTime",
        "position": 15,
        "stddev": 588.9448763,
        "variance": 346856.0673
      }
    ]
  }
}

Versions

QGIS version 3.20.2-Odense QGIS code revision 9f59a15664
Qt version 5.15.2
Python version 3.8.7
GDAL/OGR version 3.2.3
PROJ version 6.3.2
EPSG Registry database version v9.8.6 (2020-01-22)
GEOS version 3.9.1-CAPI-1.14.2
SQLite version 3.31.1
PDAL version 2.2.0
PostgreSQL client version 12.3
SpatiaLite version 4.3.0a
QWT version 6.1.4
QScintilla2 version 2.11.4
OS version macOS 11.4
       
Active Python plugins processingdb_managerMetaSearch

Additional context

No response

PeterPetrik commented 3 years ago

untwine fails to create index with the error

untwine -i sd_coord_test.laz -o ./tmp1/
libc++abi: terminating with uncaught exception of type pdal::pdal_error: writers.las: Unable to convert scaled value (-3319397519) to int32 for dimension 'X' when writing LAS/LAZ file ./tmp1//ept-data/6-0-0-6.laz.
Abort trap: 6

also this is not present in the QGIS logs (external process crashed)

PeterPetrik commented 3 years ago

This is upstream: https://github.com/hobu/untwine/issues/53

you can use --writers.las.scale_x= in translate to fix it temporary

PeterPetrik commented 3 years ago

duplicate of https://github.com/qgis/QGIS/issues/41765