mattshax / cesium_pnt_generator

Convert lidar las datasets into Cesium pnts 3d-tiles.
187 stars 62 forks source link

Getting 'error: X scale and offset combination is insufficient to represent the data' error #2

Open shrikant-dm opened 7 years ago

shrikant-dm commented 7 years ago

I have a lidar file (file.las) with the following spatial reference:

PROJCS["WGS84 / UTM zone 43N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",75],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1],AUTHORITY["EPSG","32643"]]

I am trying to convert .las file into .pint files but getting error: X scale and offset combination is insufficient to represent the data

Here is the stack trace

splitting las file
s-0001 - processing
s-0001 - attaching color to file
s-0001 - exporting color information
s-0001 - transforming las projection
error: X scale and offset combination is insufficient to represent the data
s-0001 - exporting points
Cannot open tmp/p.las for read.  Exiting...
processing points tmp/p.txt
processing colors tmp/c.txt
writing to viewer/data/s-0001
reading points file

fs.js:432
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory 'tmp/p.txt'
    at Object.fs.openSync (fs.js:432:18)
    at Object.fs.readFileSync (fs.js:286:15)
    at Object.<anonymous> (/home/test/cesium_pnt_generator/RTC.js:19:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3

Can you please help me how can I fix this issues.

mattshax commented 7 years ago

Looks like the issue has something to do with your las2las projection. Perhaps you can try to just run the las2las command with your specific spatial reference to debug the issue?

ghost commented 7 years ago

Hi @shrikant-dm, I ran into the same error when testing my LAS data in @mattshax code. But it was not that hard to fix. My suggestion is, you could use lasinfo --no-check yourLASdata.las to check the Offset X Y Z and Scale Factor X Y Z. And then use las2las command to adjust the coordinates of your data.

ghost commented 7 years ago

And thanks a lot @mattshax ^_^ I'm a beginner in point cloud and its web visualization. I started to use Cesium just a couple of days ago. And your code is absolutely really helpful to visualize LAS data in Cesium.
Now I'm trying to visualize different kinds of formats of point cloud (.xyz, e57, etc.) in Cesium. I hope it will work fine. If you also have some experience with it, it would be nice that we share our ideas :)

AmitMY commented 6 years ago

Hi @mattshax , Thanks for the awesome repo. I am having the same problem. I have a colored LAS file in 32636 projection.

I manage to scale it only between 0.01 and 1, which makes the points where they should be on the map, but just as a pillar of points: (if I zoom in a lot) image

If I claim a different projection, for example 4326, all of the points are spread across the entire globe, however I can see it is my model, because of the colors.

Using the default code, I am getting the same error as above:

error: X scale and offset combination is insufficient to represent the data

Can you please guide me (or everyone) on how to choose the correct parameters?

Here is all of the file info using lasinfo --no-check

Header Summary

Version: 1.2 Source ID: 0 Reserved: 0 Project ID/GUID: '00000000-0000-0000-0000-000000000000' System ID: 'libLAS' Generating Software: 'libLAS 1.8.1' File Creation Day/Year: 135/2018 Header Byte Size 227 Data Offset: 1081 Header Padding: 0 Number Var. Length Records: 3 Point Data Format: 3 Number of Point Records: 1541011 Compressed: False Number of Points by Return: 0 0 0 0 0 Scale Factor X Y Z: 0.00100000000000 0.00100000000000 0.00100000000000 Offset X Y Z: 681000.000 3552000.000 0.000 Min X Y Z: 681113.173 3552810.731 41.752 Max X Y Z: 681389.296 3553078.302 69.555 Spatial Reference: PROJCS["WGS 84 / UTM zone 36N", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433], AUTHORITY["EPSG","4326"]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",33], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",500000], PARAMETER["false_northing",0], UNIT["metre",1, AUTHORITY["EPSG","9001"]], AUTHORITY["EPSG","32636"]]

Geotiff_Information: Version: 1 Key_Revision: 1.0 Tagged_Information: End_Of_Tags. Keyed_Information: GTModelTypeGeoKey (Short,1): ModelTypeProjected GTRasterTypeGeoKey (Short,1): RasterPixelIsArea GTCitationGeoKey (Ascii,22): "WGS 84 / UTM zone 36N" GeogCitationGeoKey (Ascii,7): "WGS 84" GeogAngularUnitsGeoKey (Short,1): Angular_Degree ProjectedCSTypeGeoKey (Short,1): PCS_WGS84_UTM_zone_36N ProjLinearUnitsGeoKey (Short,1): Linear_Meter End_Of_Keys. End_Of_Geotiff.


VLR Summary

User: 'LASF_Projection' - Description: 'GeoTIFF GeoKeyDirectoryTag'
ID: 34735 Length: 64 Total Size: 118
User: 'LASF_Projection' - Description: 'GeoTIFF GeoAsciiParamsTag'
ID: 34737 Length: 30 Total Size: 84
User: 'liblas' - Description: 'OGR variant of OpenGIS WKT SRS'
ID: 2112 Length: 598 Total Size: 652

Schema Summary

Point Format ID: 3 Number of dimensions: 16 Custom schema?: false Size in bytes: 34

Dimensions

'X' -- size: 32 offset: 0 'Y' -- size: 32 offset: 4 'Z' -- size: 32 offset: 8 'Intensity' -- size: 16 offset: 12 'Return Number' -- size: 3 offset: 14 'Number of Returns' -- size: 3 offset: 14 'Scan Direction' -- size: 1 offset: 14 'Flightline Edge' -- size: 1 offset: 14 'Classification' -- size: 8 offset: 15 'Scan Angle Rank' -- size: 8 offset: 16 'User Data' -- size: 8 offset: 17 'Point Source ID' -- size: 16 offset: 18 'Time' -- size: 64 offset: 20 'Red' -- size: 16 offset: 28 'Green' -- size: 16 offset: 30 'Blue' -- size: 16 offset: 32

sophia-xll commented 5 years ago

Hi, @AmitMY .I am having the same problem,too. How did you solve your problem?

AmitMY commented 5 years ago

I moved from Linux to a mac, which is a different version of LASlib I did a two step process: before I split into files, I convert to my desired projection afterwards, I convert scale if needed.

I can't share my script for work reasons, but I am sure you can recreate with what I just said.