Oslandia / py3dtiles

:warning: Project migrated to : https://gitlab.com/py3dtiles/py3dtiles :warning:
https://py3dtiles.org
Other
215 stars 76 forks source link

Pointcloud is in incorrect position and disappears after changing the camera #68

Closed ThornM9 closed 4 years ago

ThornM9 commented 4 years ago

I processed a LAS file with py3dtiles to get the pnts file. The LAS SRS is WGS84, so I assumed no projection was needed when using this tool. When the camera flies to the bounding sphere of the tileset, the tileset zooms in from the side of the screen, and when the camera is changed by a fraction, it disappears. Also, the tileset is in the complete wrong area on the globe and is over the ocean. I've included some debugging information below, since I was unable to solve this. My guess is that it's an SRS issue, but not sure what the problem is exactly.

The command I ran is py3dtiles convert sample.las --out sample.

The Cesium Javascript code I'm using to load and fly to the tileset is below.

var viewer = new Cesium.Viewer('cesiumContainer');

var tileSet = new Cesium.Cesium3DTileset({ url: "Data/sample/tileset.json" });
viewer.scene.primitives.add(tileSet);

tileSet.readyPromise.then(function(tileset) {
    viewer.camera.flyToBoundingSphere(tileset.boundingSphere);
});

The output of running lasinfo sample.las is below.

---------------------------------------------------------
  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:      14/2020
  Header Byte Size             227
  Data Offset:                 1089
  Header Padding:              0
  Number Var. Length Records:  3
  Point Data Format:           3
  Number of Point Records:     9568586
  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:                494000.000 7783000.000 0.000
  Min X Y Z:                   493987.195 7782854.536 112.952
  Max X Y Z:                   494474.386 7783254.889 145.192
  Spatial Reference:           
PROJCS["WGS 84 / UTM zone 55S",
    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",147],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",10000000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32755"]]

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 55S"
      GeogCitationGeoKey (Ascii,7): "WGS 84"
      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
      ProjectedCSTypeGeoKey (Short,1): PCS_WGS84_UTM_zone_55S
      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: 606 Total Size: 660
---------------------------------------------------------
  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

---------------------------------------------------------
  Point Inspection Summary
---------------------------------------------------------
  Header Point Count: 9568586
  Actual Point Count: 9568586

  Minimum and Maximum Attributes (min,max)
---------------------------------------------------------
  Min X, Y, Z:      493987.195, 7782854.536, 112.952
  Max X, Y, Z:      494474.386, 7783254.889, 145.192
  Bounding Box:     493987.195, 7782854.536, 494474.386, 7783254.889
  Time:         0.000000, 0.000000
  Return Number:    0, 0
  Return Count:     0, 0
  Flightline Edge:  0, 0
  Intensity:        0, 0
  Scan Direction Flag:  0, 0
  Scan Angle Rank:  0, 0
  Classification:   0, 0
  Point Source Id:  0, 0
  User Data:        0, 0
  Minimum Color (RGB):  0 256 0 
  Maximum Color (RGB):  65280 65280 65280 

  Number of Points by Return
---------------------------------------------------------
    (1) 9568586

  Number of Returns by Pulse
---------------------------------------------------------
    (0) 9568586

  Point Classifications
---------------------------------------------------------
    9568586 Created, never classified (0) 
  -------------------------------------------------------
    0 withheld
    0 keypoint
    0 synthetic
  -------------------------------------------------------
autra commented 4 years ago

From your metadata, I think your pointcloud is in EPSG:32755. It is situated in Australia near Charter Towers, am I right?

If yes, then you should add --srs_out 4978 to your py3dtiles convert command, because that's the CRS Cesium expects 3dtilsets.

It is the same issue as #66 so I guess I should create a FAQ ;-)

Please let me know if it works better.

delhomer commented 4 years ago

Moved to https://gitlab.com/Oslandia/py3dtiles/-/issues/68