File name as attribute: Lasboundary

301 views
Skip to first unread message

Sampath (CTR), Aparajithan

unread,
Apr 17, 2017, 2:27:47 PM4/17/17
to last...@googlegroups.com
Hi

Is it possible to save file name as attribute when using lasboundary to generate shapefiles?

I have multiple LAS files (tiles actually) in a folder, and I would like to create a shapefile of their boundaries.

is there any way to add something to the command:

lasboundary -i *.las -use_bb -merged -o merged.shp

and make sure that the resulting merged.shp has an attribute field with the file names of individual files?

Thanks

Aparajithan Sampath, PhD
Stinger Ghaffarian Technologies, Inc. (SGT)
Contractor to the U.S. Geological Survey (USGS)
Earth Resources Observation and Science (EROS) Center
47914 252nd Street
Sioux Falls, SD 57198

NOTE - E-mail address change as of April 4, 2016. Please update your contact list accordingly!

Michael Hannon

unread,
Apr 18, 2017, 9:37:59 AM4/18/17
to last...@googlegroups.com
Hi -

I don't know how do to this in lasboundary, but I've done it using
ogrinfo and ogr2ogr in a batch file, like so:

----------
lasboundary -i *.las -use_bb -odir . -oshp

for %%f in (*.shp) do (
if not "%%f" == "merge.shp" (
ogrinfo %%f -sql "ALTER TABLE %%~nf ADD COLUMN fname character(50)"
ogrinfo %%f -dialect SQLite -sql "UPDATE '%%~nf' SET fname = '%%~nf'"
ogr2ogr -update -append merge.shp %%f -f "ESRI SHAPEFILE" -nln merge
)
)
pause
-----------

Note that one shapefile is created for each LAS file; the -merged option
is not used.

ogrinfo is used to create the attribute and assign the filename to the
attribute; ogr2ogr is used to merge all of the shapefiles into a single
shapefile.

Getting the OGR suite can be difficult; the easiest way I've found is
through the osgeo4W installer.

- Michael Hannon

On 2017-04-17 15:03, Sampath (CTR), Aparajithan wrote:
> Hi
>
> Is it possible to save file name as attribute when using lasboundary to
> generate shapefiles?
>
> I have multiple LAS files (tiles actually) in a folder, and I would like
> to create a shapefile of their boundaries.
>
> is there any way to add something to the command:
>
> lasboundary -i *.las -use_bb -merged -o merged.shp
>
> and make sure that the resulting merged.shp has an attribute field with
> the file names of individual files?
>
> Thanks
>
> Aparajithan Sampath, PhD
> Stinger Ghaffarian Technologies, Inc. (SGT)
> Contractor to the U.S. Geological Survey (USGS)
> Earth Resources Observation and Science (EROS) Center
> 47914 252nd Street
> Sioux Falls, SD 57198
> Phone: 605-594-6102
> Fax: 605-594-2828
> aparajithan...@usgs.gov <mailto:aparajithan...@usgs.gov>
>
> *NOTE - E-mail address change as of April 4, 2016. Please update your
> contact list accordingly!*
>
> --
> Download LAStools at
> http://lastools.org
> http://rapidlasso.com
> Be social with LAStools at
> http://facebook.com/LAStools
> http://twitter.com/LAStools
> http://linkedin.com/groups/LAStools-4408378
> Manage your settings at
> http://groups.google.com/group/lastools/subscribe

Tina Cormier

unread,
Apr 27, 2017, 10:45:18 AM4/27/17
to last...@googlegroups.com
Hi,

In the past, I have done this in separate steps, but it would be great if it could be done as one step to achieve an index of the ground coverage. My two steps are 1. lasboundary (as you have done) to produce a merged shapefile of actual lidar coverage and then 2. Intersect ground coverage from step 1 with index polygons containing file paths/names. If you don't have have an index with your file names in it (which I assume you don't given the question) there are probably many ways you could do it, but I used las2tindex: https://github.com/libLAS/libLAS/blob/master/python/scripts/las2tindex.py. This script provides an index, but it's not the exact ground coverage that lasboundary provides. Combining them gives you what you want, I think.

I'd love to know if this sort of ground index, as I'm calling it, can be created in one step with lastools?

Hope that helps!
Tina




*NOTE - E-mail address change as of April 4, 2016. Please update your
contact list accordingly!*

--
Download LAStools at
http://lastools.org
http://rapidlasso.com
Be social with LAStools at
http://facebook.com/LAStools
http://twitter.com/LAStools
http://linkedin.com/groups/LAStools-4408378
Manage your settings at
http://groups.google.com/group/lastools/subscribe

Martin Isenburg

unread,
May 13, 2017, 2:27:44 PM5/13/17
to LAStools - efficient command line tools for LIDAR processing
Hello Ajith,

this is possible in the latest version (170511). Try this:

E:\LAStools\bin>mkdir mist

E:\LAStools\bin>lastile -i ..\data\fusa.laz ^
                                     -tile_size 100 ^
                                     -odir mist -o futi.laz

E:\LAStools\bin>lasboundary -i mist\futi*.laz ^
                                               -overview -labels ^
                                               -o result.shp
or

E:\LAStools\bin>lasboundary -i mist\futi*.laz ^
                                               -overview -labels ^
                                               -o result.kml

Note *not* to put a merged. This results in a single SHP or KML file that lists all the tiles with name, LAS version, point type, point number, bounding box, ...

The generated KML also gives you the opportunity to make a minimal download page by simply adding a base URL to where you will upload the files too. See the attached image for the kind of result you can expect.

E:\LAStools\bin>lasboundary -i mist\futi*.laz ^
                                               -overview -labels ^
                                               -base_url "http://lastools.org/download" ^
                                               -o result.kml

Other changes in the latest version:
===========================

11 May 2017 -- LASlib: new transforms '-copy_classification_into_user_data' and '-copy_attribute_into_user_data 1'
10 May 2017 -- las2dem, blast2dem, lasgrid: fix rounding error for ususual or very small step sizes (0.2 or less)
5 May 2017 -- lasground + lasground_new: user data change due to '-compute_height' makes it into LASlayers output
28 April 2017 -- lasboundary: allow creation of KML and SHP '-overview' files for multiple LAS/LAZ files
26 April 2017 -- lasboundary: also adding option to add '-labels' to SHP output that populate the DBF attibutes
25 April 2017 -- LASzip DLL: "native LAS 1.4 extension" in LASzip DLL via 'laszip_request_native_extension()'
24 April 2017 -- lastile: also '-remove_buffer' for buffers generated by on-the-fly buffering (= '-buffered 50')
22 April 2017 -- lasground and lasground_new: fix of bb extend for '-buffered 20' and '-remain_buffered' combo
20 April 2017 -- LASlib: new option '-unbuffered' for lasreadopener removes buffers from on-the-fly buffering


On Mon, Apr 17, 2017 at 8:03 PM, Sampath (CTR), Aparajithan <aparajithan...@usgs.gov> wrote:
Hi

Is it possible to save file name as attribute when using lasboundary to generate shapefiles?

I have multiple LAS files (tiles actually) in a folder, and I would like to create a shapefile of their boundaries.

is there any way to add something to the command:

lasboundary -i *.las -use_bb -merged -o merged.shp

and make sure that the resulting merged.shp has an attribute field with the file names of individual files?

Thanks
Aparajithan Sampath, PhD
Stinger Ghaffarian Technologies, Inc. (SGT)
Contractor to the U.S. Geological Survey (USGS)
Earth Resources Observation and Science (EROS) Center
47914 252nd Street
Sioux Falls, SD 57198

NOTE - E-mail address change as of April 4, 2016. Please update your contact list accordingly!

lasboundary_base_url_simple_download_portal.jpg
Reply all
Reply to author
Forward
0 new messages