Ascii file precision

38 views
Skip to first unread message

Wes Toews

unread,
Dec 22, 2025, 12:19:01 PM (2 days ago) Dec 22
to last...@googlegroups.com
Hi, when I run an ascii file with precision to three decimal places through las2las64 (or txt2las64), it seems to drop precision of the input ascii file to two decimal places. Setting -target_precision doesn't seem to change this behavior. Am I imagining things, or is this expected for some reason?

Thanks in advance!

Terje Mathisen

unread,
Dec 23, 2025, 4:52:38 AM (yesterday) Dec 23
to last...@googlegroups.com, Wes Toews
Have you looked at 'set_scale 0.001' or something similar?

I'm guessing that since an ascii file has no header, LAStools is using the built-in defaults wherever it can, including the use of cm precision for all coordinates.

cm does come with a big advantage, in that a 32-bit signed integer can handle numbers +/- 2e9, so with cm scale you can address a range of +/- 20M meters, right? The distance from equator to the north pole was originally defined to be exactly 10k km and the distance around equator is a bit more than 40 000 km.

This means that with cm precision there is no need to figure out proper offset variables, you can leave them all at zero! :-)

Terje

Wes Toews wrote:
Hi, when I run an ascii file with precision to three decimal places through las2las64 (or txt2las64), it seems to drop precision of the input ascii file to two decimal places. Setting -target_precision doesn't seem to change this behavior. Am I imagining things, or is this expected for some reason?

Thanks in advance!
--
Download LAStools at
https://rapidlasso.de
Manage your settings at
https://groups.google.com/g/lastools/membership
---
You received this message because you are subscribed to the Google Groups "LAStools - efficient tools for LiDAR processing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lastools+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lastools/CAFjRCrrETPZ%3DoRFe0xikeCPwV%2BdKdu0FzEsuzsM0wVSsn01BHw%40mail.gmail.com.


-- 
- <Terje.M...@tmsw.no>
"almost all programming can be viewed as an exercise in caching"

Jochen Rapidlasso

unread,
Dec 23, 2025, 11:46:58 AM (yesterday) Dec 23
to LAStools - efficient tools for LiDAR processing
Hi Wes,
the trick is to tell the LAZ target what we want to have in the header.
Within the text file we do not have much information about requested header values.
To take the full resolution of an input column would lead to probably many file in mm or even higher resolution.
So if you really need this precision you have to tell this to LAStools.
A small sample:
First we create a text file to import with the required resolution (tmp2.txt):

58673.883 2152516.352 2737.19
58674.136 2152516.354 2736.24
58674.340 2152516.352 2736.32
58674.540 2152516.357 2736.35

Now we use las2las64 to read the file and write the data into LAZ format:

    las2las64 -i tmp2.txt -o tmp4.laz -iparse xyz -set_version 1.4 -set_point_type 6 -rescale 0.001 0.001 0.01

The important argument is "rescale" to change from the default scaling (cm) to the requested scaling in the header.
In the sample we have chosen [mm] for [xy] and [cm] for [z].
This works with txt2las64 as well:

    txt2las64 -i tmp2.txt -o tmp5.laz -iparse xyz -set_version 1.4 -set_point_type 6 -rescale 0.001 0.001 0.01

A final review will confirm this:

las2las64 -i tmp4.laz -stdout -otxt -oparse xyz
las2las64 -i tmp5.laz -stdout -otxt -oparse xyz

Cheers,

Jochen @rapidlasso

Wes Toews

unread,
Dec 23, 2025, 4:03:05 PM (23 hours ago) Dec 23
to last...@googlegroups.com

Thanks for confirming rescale Jochen. In the case of an ascii -> ascii operation, do we need to worry about the offset or does las2las (or whatever) bypass the integer overflow situation entirely?

 

Wes

LAStools - efficient tools for LiDAR processing

unread,
3:30 AM (12 hours ago) 3:30 AM
to LAStools - efficient tools for LiDAR processing
Hi Wes,
never worry. 
Give it a try, we expect it will work.
If not, give an example and we will analyze.

Cheers,

Jochen
Reply all
Reply to author
Forward
0 new messages