# Problem with Y offset shift of LAS file (las2las)

I'm trying to set the origin of a georeferenced .las point cloud to be coordinates 0,0,0, essentially stripping the georeferencing. The only way I could think to do this was subtract the minimum X, Y and Z value of each point using lastools (las2las). I was able to do this with the X and Z coordinates, but when I subtracted the Y coordinates something strange happened: starting with a minimum Y value 2,887,191 I subtracted 2,887,191 and got 4,294,967. I haven't been able to get it to 0.

Anyone have any idea what's happening here?

EDIT:

To be clear: I'm interested in setting the minimum x,y and z values of the .las file to 0, 0 and 0, ignoring the header and stripping georeferencing entirely but preserving the spatial relationship of the points. The best mathematical way I can think to do this is to subtract the minimum values of each axis from every point. Does anyone know of tools that can do that?

• The LAS file format already applies an offset and scaling factor, which are applied to the stored point locations once they are read. Do you know, are you applying your offsets to the raw points coordinates (i.e. the values before the file's offset and scale factors are applied) or after? Sep 16, 2014 at 21:05
• Can you do LasInfo on before and after and post that, that might help explain the difference. Sep 16, 2014 at 21:54
• I guess my point, though not clearly stated, is that the LAS file format already has an offset defined. When you read the coordinates of a point, it applies these offset and scaling parameters to each point. The offsets are usually set to the minimum X, Y and Z values respectively. Rather than subtracting a constant value from each point in the file, you simply need to set the offsetX, offsetY, and offsetZ values to zero. Sep 16, 2014 at 22:29
• This offsets the points as it relates to the georeferencing, no? I'm more interested in directly setting the origin to 0,0 in X and Y and the minimum Z value to 0. I need to ignore the header entirely.
– Wes
Sep 24, 2014 at 19:40
• @Wes Can the solution take your LAS input and output a multipoint shapefile? Or is there a requirement that the output must still be a LAS file? Sep 30, 2014 at 13:45

Fusion LTK has a tool specifically for what you are trying to do. Its name is `ClipData`.

You'll need two switches (variations of the command line) to accomplish the task. The first switch is the `biaselev:#` (bias elevation of number equal to #). From Fusion's manual:

biaselev:# Add an elevation offset to every LIDAR point: # can be + or -.

So, let's say the minimum z value is 702, then, you would have /biaselev:702 to subtract all z coordinates with 702.

The second switch, which offsets x and y, is the `nooffset`. See its description from the manual:

nooffset: Produce an output point file that no longer has the correct georeferencing. This is used when you need to work with the point cloud but cannot reveal the actual location of the features represented in the point cloud. This option modifies the header values in the LAS header for the output files.

The complete command line for your case would be written like the following:

``````/ClipData /biaselev:# /nooffset InputSpecifier SampleFile [MinX MinY MaxX MaxY]
``````

where `InputSpecifier` is the gross lidar cloud (.las file), the `SampleFile` is the new .las file with the offsets and `[MinX MinY MaxX MaxY]` are the minimums and maximums x and y from the gross lidar cloud, respectively.

Here I wrote a detailed answer which teaches how to use `ClipData` that you can adapt for your case using information from this post.

Just to exemplify that this works, I ran a test with one file of mine. Here is a screenshot of the new .las file's header.

if you use python, there's a useful library

``````from liblas import file

f = file.File('file.las',mode='r')
for p in f:
print 'X,Y,Z: ', p.x, p.y, p.z
``````

doing it this way may give you some direct access to the numbers...then create another las file with a custom header and save your values to it. But I don't know what you want to do with your numbers so I can't say this is what you need. If there's a las-tools app that transforms your origin somehow, that'd fix your x-y but the z is another story.