Scale a point cloud to a specific point (scale from a Mercator grid to plane coordinates and vice versa)

896 views
Skip to first unread message

James Carracher

unread,
Jan 18, 2024, 2:11:41 AM1/18/24
to LAStools - efficient tools for LiDAR processing

Hi,

 

I have a question about something I can’t quite work out and I’m at a loss. I can’t work out how to do something that is really common in land surveying, I’m 50% sure that lastools can even do what I want. The problem is scaling a point cloud about an origin coordinate to shift between grid coordinates and plane coordinates.

 

The formula for essentially what I am doing is:

X’new = (SCALE_FACTOR * (X’old – ORIGIN_X)) + ORIGIN_X

Y’new = (SCALE_FACTOR * (Y’old – ORIGIN_Y)) + ORIGIN_Y

 

Basically, I want to scale as per normal, but using a specific coordinate as the origin. The way I can see this is to either translate by a – X/Y origin to effectively set it to 0, then scale, and then translate back, or to somehow set the coordinate origin to the X/Y origin points, scale, and then set the origin back to 0,0. The first method causes a coordinate overflow, the second option I can’t work out how to do. If I just use -reoffset like has been mentioned in other threads then I don’t get the overflow, but it is scaling from, 0/0 not the X/Y origin so I get a result that is 100’s of metres wrong.

 

If you have any advice that would be appreciated.

 

If have included a simplified version of my current code which mostly works but has rounding errors because of the las integer overflow. Also, the original point cloud has a scale factor of 0.001 in the header and I want to keep the mm precision.

 

SCALE_FACTOR =1.0001

ORIGIN_X =331147.806

ORIGIN_Y =6247816.055

 

:: translate to -X/Y origin then scale

las2las -cpu64 -i "INPUT\*.laz" ^

                -translate_then_scale_x -ORIGIN_X SCALE_FACTOR ^

                -translate_then_scale_y -ORIGIN_Y SCALE_FACTOR ^

                -odir temp1 ^

                -olaz

                               

:: translate back by original X/Y origin

"%LASTOOLS_DIR%\las2las.exe" -cpu64 -i "%WORK_DIRECTORY%\temp1\*.laz" ^

                -translate_x ORIGIN_X ^

                -translate_y ORIGIN_Y ^

                -odir temp2 ^

                -olaz

 

Regards,

 

James

Jochen Rapidlasso

unread,
Jan 18, 2024, 11:50:36 AM1/18/24
to LAStools - efficient tools for LiDAR processing
Hi James,
we tried hard to solve this formula with the existing arguments.
After some hours of trying we have to say: Its hard to do.
Dependent of the header offset and the range within your point data you most likely will get a range violation error within the Int32 range of
your point coordinates.
It would have been better if we had implemented this directly in the program - as we have now done:

Please download
    https://downloads.rapidlasso.de/beta/las2las64.zip

New arguments are
  -translate_scale_translate_x [t] [s]
  -translate_scale_translate_y [t] [s]
  -translate_scale_translate_z [t] [s]

[t] = translation (float)
[s] = scale (float)

It will calculate
    out = (in – t)*s + t

Use the arguments
  -translate_scale_translate_x 331147.806 1.0001
  -translate_scale_translate_y 6247816.055 1.0001
to solve your sample.

We will include this in the next official release.

Best regards,

Jochen @rapidlasso

James Carracher

unread,
Jan 19, 2024, 2:11:05 AM1/19/24
to LAStools - efficient tools for LiDAR processing
Thanks Jochen for the very quick turnaround!

That works perfectly from my testing

James
Reply all
Reply to author
Forward
0 new messages