visr / LasIO.jl

Julia package for reading and writing the LAS lidar format.
Other
22 stars 13 forks source link

add @sprintf statements to improve printing consistency #35

Closed Crghilardi closed 4 years ago

Crghilardi commented 4 years ago

Currently the header files can print an inconsistent mix of scientific and standard notation depending on the source file.

Before:

using FileIO, LasIO
header, points = load("libLAS_1.2.las")

LasHeader with 497536 points.
#...stuff...
        x_max = 1.44499996e6
        x_min = 1.44e6
        y_max = 379999.99
        y_min = 375000.03
        z_max = 972.6700000000001
        z_min = 832.1800000000001

This PR modifies the Base.show to ensure a consistent format for the min/max fields. I don't think the other fields would have this issue.

After:

julia> header1, points1 = load("libLAS_1.2.las")
(LasHeader with 497536 points.
 #..stuff..
        x_max = 1444999.9600000
        x_min = 1440000.0000000
        y_max = 379999.9900000
        y_min = 375000.0300000
        z_max = 972.6700000
        z_min = 832.1800000

Note: This does add Printfas a dependency to the Project.TOML but I thought it would be reasonable since it's part of the standard library.

visr commented 4 years ago

Yeah I agree that this looks better, especially in examples like the one you give. Thanks for the PR!