hobuinc / untwine

GNU General Public License v3.0
52 stars 21 forks source link

SRS from input LAS not copied to output #176

Open maphew opened 5 hours ago

maphew commented 5 hours ago

unwtine -i path/to/dir_of_las -o converted.copc.laz creates a file that does not have a coordinate system defined.

This means the output file cannot be used in https://viewer.copc.io/. I haven't tried any other COPC client (I'm new to this format).

Attached are the pdal info for the output and one of the input las files (they all have the same srs, EPSG:4326).

maphew commented 5 hours ago

attempting to use assign srs option yields an error:

untwine -i path\to\terra_las -o output_copc.laz --a_srs espg:4326 --stats Untwine Error: Could not import coordinate system 'espg:4326': (unknown reason).

maphew commented 5 hours ago

ahh, srs argument is case sensitive and needs to upper case, --a_srs EPSG:4326.

The result still can't be read in viewer.copc.io. I don't see a public repository for that so don't know where to file the bug, if it is a bug. The error there is "cartesian has a NaN component"

connormanning commented 5 hours ago

One note is that you should generally not use EPSG:4326 for COPC. Since the index is a Cartesian octree, you should avoid using EPSG:4326 since all sorts of strange things can happen from assuming polar coordinates are Cartesian. You might try UTM, or EPSG:3857 for example.

Also, I don't think your data is actually EPSG:4326... your input_las_info.json has a native bbox that is not 4326:

        "bbox":
        {
          "maxx": 458589.2905,
          "maxy": 7101546.721,
          "maxz": 880.2668976,
          "minx": 457889.4155,
          "miny": 7100501.704,
          "minz": 770.6110976
        },

The bbox['EPSG:4326'] value in the info output has been reprojected to 4326 for convenience but does not mean that the data is natively in EPSG:4326. So telling Untwine to consider the data as 4326 with a_srs definitely seems wrong.

You can use pdal info <myfile.laz> --metadata to see what PDAL extracts for the SRS, it appears in multiple formats in that output but one instance is the the comp_spatialreference key. As far as I know, Untwine will simply forward the SRS from your input.

You have posted some output derived from your data but posting an actual sample file will be the best way to get help. Otherwise we'll just be guessing, your problem could be invalid SRS, unrecognized (but valid) SRS, geographic SRS when it should be Cartesian, some issue like the COPC bounds being computed oddly from malformed data points, or a variety of other issues.

So please provide a sample file that reproduces the issue if you cannot get things working properly.

maphew commented 4 hours ago

Thanks for the feedback. Is there a way to downsample the input into something reasonable for sharing and testing?

I was suprised to see EPSG:4326 reported for the LAS, I expected UTM-N08.

maphew commented 4 hours ago

output of pdal info myfile.las --metadata : input_las_info_metadata.json. It seems to be UTM Zone N8 WGS-84 throughout?

maphew commented 3 hours ago

Specifically assigning the EPSG code that pdal ... --metadata reports for the input.las creates an output.laz that viewer.copc.io is happy with.

untwine -i ....\from_dji_terra\lidars\terra_las -o output_copc.laz --a_srs EPSG:32608

After this project is published I can share the source data for future troubleshooting if you're interested. That is a number of weeks out.

abellgithub commented 2 hours ago

I don't think there's a bug here. Is that correct? Can this be closed?