Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to convert scaled value (2147483648) to int32 for dimension 'Y' #126

Closed
wonder-sk opened this issue Jul 11, 2022 · 4 comments
Closed

Comments

@wonder-sk
Copy link
Contributor

Originally reported as a bug in QGIS: qgis/QGIS#49317

When processing a particular LAS file, untwine gets to 99% and then crashes with this output:

Exception: Unable to convert scaled value (2147483648) to int32 for dimension 'Y' when writing LAS/LAZ file.
Exception: Unable to convert scaled value (2147483648) to int32 for dimension 'Y' when writing LAS/LAZ file.

Not sure if the file can be publicly shared, link available on request.

The value 2147483648 is equal to 2^32, so it makes sense that it does not fit to int32 value, but if the scaling is unchanged, there must be something wrong as the original value must have fitted to int32...

The scaling of x/y/z looks a bit suspicious to me (~1e-8)

CloudCompare opens the file without any errors.

Metadata:

$ pdal info --metadata antea_Model_1.las
{
  "filename": "antea_Model_1.las",
  "metadata":
  {
    "comp_spatialreference": "",
    "compressed": false,
    "count": 53773852,
    "creation_doy": 192,
    "creation_year": 2022,
    "dataformat_id": 2,
    "dataoffset": 227,
    "filesource_id": 0,
    "global_encoding": 0,
    "global_encoding_base64": "AAA=",
    "header_size": 227,
    "major_version": 1,
    "maxx": 204.300354,
    "maxy": 22.56153297,
    "maxz": 23.07263947,
    "minor_version": 2,
    "minx": -26.83881378,
    "miny": -60.2872963,
    "minz": -5.98761034,
    "offset_x": 88.730770111084,
    "offset_y": -18.8628816604614,
    "offset_z": 8.54251456260681,
    "point_length": 26,
    "project_id": "9D103B86-4A52-4548-AA16-D86D5E37BB36",
    "scale_x": 5.38162812342115e-08,
    "scale_y": 1.92897462537486e-08,
    "scale_z": 6.76611667009598e-09,
    "software_id": "CaptureReality",
    "spatialreference": "",
    "srs":
    {
      "compoundwkt": "",
      "horizontal": "",
      "isgeocentric": false,
      "isgeographic": false,
      "prettycompoundwkt": "",
      "prettywkt": "",
      "proj4": "",
      "units":
      {
        "horizontal": "unknown",
        "vertical": ""
      },
      "vertical": "",
      "wkt": ""
    },
    "system_id": "Microsoft Windows"
  },
  "pdal_version": "2.0.1 (git-version: Release)"
}

pdal info with stats:

$ pdal info antea_Model_1.las                                                            
{
  "filename": "antea_Model_1.las",
  "pdal_version": "2.0.1 (git-version: Release)",
  "stats":
  {
    "bbox":
    {
      "native":
      {
        "bbox":
        {
          "maxx": 204.300354,
          "maxy": 22.56153297,
          "maxz": 23.07263947,
          "minx": -26.83881378,
          "miny": -60.2872963,
          "minz": -5.98761034
        },
        "boundary": "{ \"type\": \"Polygon\", \"coordinates\": [ [ [ -26.838813781738281, -60.287296295166016, -5.987610340118408 ], [ -26.838813781738281, 22.561532974243164, -5.987610340118408 ], [ 204.30035400390625, 22.561532974243164, 23.072639465332031 ], [ 204.30035400390625, -60.287296295166016, 23.072639465332031 ], [ -26.838813781738281, -60.287296295166016, -5.987610340118408 ] ] ] }"
      }
    },
    "statistic":
    [
      {
        "average": 2.120140667,
        "count": 53773852,
        "maximum": 204.300354,
        "minimum": -26.83881378,
        "name": "X",
        "position": 0,
        "stddev": 12.64424578,
        "variance": 159.8769514
      },
      {
        "average": -1.399266328,
        "count": 53773852,
        "maximum": 22.56153297,
        "minimum": -60.2872963,
        "name": "Y",
        "position": 1,
        "stddev": 6.769987871,
        "variance": 45.83273577
      },
      {
        "average": 2.607783115,
        "count": 53773852,
        "maximum": 23.07263947,
        "minimum": -5.98761034,
        "name": "Z",
        "position": 2,
        "stddev": 1.404187613,
        "variance": 1.971742852
      },
      {
        "average": 65535,
        "count": 53773852,
        "maximum": 65535,
        "minimum": 65535,
        "name": "Intensity",
        "position": 3,
        "stddev": 8.936917196,
        "variance": 79.86848896
      },
      {
        "average": 1,
        "count": 53773852,
        "maximum": 1,
        "minimum": 1,
        "name": "ReturnNumber",
        "position": 4,
        "stddev": 0.0001363686152,
        "variance": 1.859639921e-08
      },
      {
        "average": 1,
        "count": 53773852,
        "maximum": 1,
        "minimum": 1,
        "name": "NumberOfReturns",
        "position": 5,
        "stddev": 0.0001363686152,
        "variance": 1.859639921e-08
      },
      {
        "average": 0,
        "count": 53773852,
        "maximum": 0,
        "minimum": 0,
        "name": "ScanDirectionFlag",
        "position": 6,
        "stddev": 0,
        "variance": 0
      },
      {
        "average": 0,
        "count": 53773852,
        "maximum": 0,
        "minimum": 0,
        "name": "EdgeOfFlightLine",
        "position": 7,
        "stddev": 0,
        "variance": 0
      },
      {
        "average": 32,
        "count": 53773852,
        "maximum": 32,
        "minimum": 32,
        "name": "Classification",
        "position": 8,
        "stddev": 0.004363795686,
        "variance": 1.904271279e-05
      },
      {
        "average": 0,
        "count": 53773852,
        "maximum": 0,
        "minimum": 0,
        "name": "ScanAngleRank",
        "position": 9,
        "stddev": 0,
        "variance": 0
      },
      {
        "average": 0,
        "count": 53773852,
        "maximum": 0,
        "minimum": 0,
        "name": "UserData",
        "position": 10,
        "stddev": 0,
        "variance": 0
      },
      {
        "average": 0,
        "count": 53773852,
        "maximum": 0,
        "minimum": 0,
        "name": "PointSourceId",
        "position": 11,
        "stddev": 0,
        "variance": 0
      },
      {
        "average": 46461.03622,
        "count": 53773852,
        "maximum": 61680,
        "minimum": 15420,
        "name": "Red",
        "position": 12,
        "stddev": 11407.8311,
        "variance": 130138610.4
      },
      {
        "average": 48540.29937,
        "count": 53773852,
        "maximum": 61680,
        "minimum": 15420,
        "name": "Green",
        "position": 13,
        "stddev": 10192.46728,
        "variance": 103886389.2
      },
      {
        "average": 49397.45554,
        "count": 53773852,
        "maximum": 61680,
        "minimum": 15420,
        "name": "Blue",
        "position": 14,
        "stddev": 10971.27374,
        "variance": 120368847.5
      }
    ]
  }
}
@hobu
Copy link
Collaborator

hobu commented Jul 11, 2022

This data is silly.

@hobu
Copy link
Collaborator

hobu commented Jul 11, 2022

QGIS should warn and clamp data it sees with scale < 1e-6. This isn't Untwine's bug to fix. We can't decide to clamp the data for the user.

Note: The file in question here is in the last two items of this useful XKCD primer on geographic coordinate precision.

image

@abellgithub
Copy link
Collaborator

@wonder-sk : I think this should be as resolved as possible thanks to #149.

@uclaros
Copy link
Contributor

uclaros commented Feb 22, 2024

Indeed, the file now gets indexed successfully, you can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants