Commit 2fd7020e authored by Emmanuel Christophe's avatar Emmanuel Christophe

ENH: Adding lislab (reading LIDAR data)

parent 9ee7056b
......@@ -26,7 +26,7 @@ ENDIF(NOT OTB_USE_EXTERNAL_EXPAT)
#Supress libraries not used by the 2.2.0 version
#SUBDIRS(BGL otbsvm dxflib InsightJournal otbossim otb6S otbgeotiff tinyXMLlib otbgalib otbkml)
SUBDIRS(BGL otbsvm dxflib InsightJournal otbossim otb6S otbgeotiff tinyXMLlib otbkml)
SUBDIRS(BGL otbsvm dxflib InsightJournal otbossim otb6S otbgeotiff tinyXMLlib otbkml otbliblas)
IF(BUILD_TESTING)
SUBDIRS( Dart )
......
Mateusz Loskot
mateusz at loskot.net
Howard Butler
hobu.inc at gmail.com
Martin Vales
mrodriguez at stereocarto.com
Phillipe Vachon
philippe at cowpig.ca
Frank Warmerdam
warmerdam at pobox.com
\ No newline at end of file
PROJECT(liblas)
SET(liblas_VERSION_MAJOR "1")
SET(liblas_VERSION_MINOR "0")
SET(liblas_VERSION_PATCH "0")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/liblas)
SET(liblas_SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
SET(liblas_SOURCES
${liblas_SOURCES_DIR}/las_c_api.cpp
${liblas_SOURCES_DIR}/lasfile.cpp
${liblas_SOURCES_DIR}/laspoint.cpp
${liblas_SOURCES_DIR}/lasrecordheader.cpp
${liblas_SOURCES_DIR}/laserror.cpp
${liblas_SOURCES_DIR}/lasheader.cpp
${liblas_SOURCES_DIR}/lasreader.cpp
${liblas_SOURCES_DIR}/laswriter.cpp
${liblas_SOURCES_DIR}/detail/file.cpp
${liblas_SOURCES_DIR}/detail/reader10.cpp
${liblas_SOURCES_DIR}/detail/reader11.cpp
${liblas_SOURCES_DIR}/detail/reader.cpp
${liblas_SOURCES_DIR}/detail/writer10.cpp
${liblas_SOURCES_DIR}/detail/writer11.cpp
${liblas_SOURCES_DIR}/detail/writer.cpp
)
ADD_LIBRARY(otbliblas ${liblas_SOURCES} )
PROJECT(liblas)
SET(liblas_VERSION_MAJOR "1")
SET(liblas_VERSION_MINOR "0")
SET(liblas_VERSION_PATCH "0")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/liblas)
SET(liblas_SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
SET(liblas_SOURCES
${liblas_SOURCES_DIR}/las_c_api.cpp
${liblas_SOURCES_DIR}/lasfile.cpp
${liblas_SOURCES_DIR}/laspoint.cpp
${liblas_SOURCES_DIR}/lasrecordheader.cpp
${liblas_SOURCES_DIR}/laserror.cpp
${liblas_SOURCES_DIR}/lasheader.cpp
${liblas_SOURCES_DIR}/lasreader.cpp
${liblas_SOURCES_DIR}/laswriter.cpp
${liblas_SOURCES_DIR}/detail/file.cpp
${liblas_SOURCES_DIR}/detail/reader10.cpp
${liblas_SOURCES_DIR}/detail/reader11.cpp
${liblas_SOURCES_DIR}/detail/reader.cpp
${liblas_SOURCES_DIR}/detail/writer10.cpp
${liblas_SOURCES_DIR}/detail/writer11.cpp
${liblas_SOURCES_DIR}/detail/writer.cpp
)
ADD_LIBRARY(otbliblas ${liblas_SOURCES} )
\ No newline at end of file
***************************************************************
libLAS Installation
***************************************************************
Unix
~~~~~~~~~~~~~~~~~~~
libLAS uses a typical GNU autoconf/automake framework for
building and installation on unix-like platforms.
The quick and dirty installation that would install things
by default in /usr/local might look like:
::
./configure
make
make install
Configure libLAS for debugging and install in my home directory:
::
./configure --enable-debug --prefix=/home/hobu/liblas
Windows
~~~~~~~~~~~~~~~~~~~
Copy the windows package zip file into a directory of your
choosing and unzip. You should be able to run the utility
applications.
\ No newline at end of file
SUBDIRS = src apps include test
This diff is collapsed.
libLAS - LAS 1.0/1.1 ASPRS LiDAR data translation toolset
==============================================================================
libLAS is a C/C++ library for reading and writing ASPRS LAS version 1.0 and 1.1
data. LAS-formatted data is heavily used in `LiDAR`_ processing operations, and
the LAS format is a sequential binary format used to store data from sensors
and as intermediate processing storage by some applications.
libLAS is available under the terms of the `BSD License`_. It builds on work
by `Martin Isenburg and Jonathan Shewchuk`_ of the University of North
Carolina in their `LAStools`_ project. libLAS' base C++ library that reads
and writes LAS 1.0/1.1 data was replaced with new development, and Martin's
tools were ported to use this new code.
libLAS' initial development was supported by the `IGSB`_ of the Iowa DNR
for use in its state-wide `LIDAR`_ project.
Download
------------------------------------------------------------------------------
The 1.0.0 version of libLAS can be downloaded from http://liblas.org/wiki/1.0.0
Older releases may be obtained from http://liblas.org/wiki/Releases
Binaries
..............................................................................
Windows binaries of libLAS are provided in two forms. The easiest form is
to obtain `OSGeo4W`_ and select the libLAS package to install. Alternatively,
you can download a Windows package with full spatial reference support from
the release page. GDAL support is only provided with the `OSGeo4W`_ package, however.
Linux, Mac OS X, and Solaris binaries are not provided. The source code
uses the standard GNU autotools/automake stack for compilation and installation.
Documentation
------------------------------------------------------------------------------
`LAStools`_ / libLAS Command-line Utilities
..............................................................................
* `las2las`_
* `lasinfo`_
* `las2txt`_
* `txt2las`_
* `lasmerge`_
Software Development with libLAS
..............................................................................
* `FOSS4G 2008`_ presentation that provides a basic overview of the design and philosophy of libLAS
* `Tutorials`_ - tutorials on using libLAS from C++, Python and .NET/Mono languages
* `LAS C API`_- doxygen docs that describe the libLAS C API
* `dotnetLibLAS API`_ - docs for the .NET API
* `LAS Doxygen Docs`_ - doxygen docs of the entire C/C++ API
* `LAS Format Elements`_ - comparison of elements of LAS Format 1.0 and 1.1
* `Software`_ - a list of geospatial software with reading and writing capabilities of LAS Format
* `Resources`_ - a list of general LiDAR/LAS resources
LAS Format Specifications
..............................................................................
The LAS Format Standard is maintained by `ASPRS Standards Committee`_. LAS
format standard documents are available in PDF format:
* `LAS 2.0 Format Standard`_ (2007-08-17) - *Proposed*
* `LAS 1.2 Format Standard`_ (2008-05-02) - *Proposed*
* `LAS 1.1 Format Standard`_ (2005-05-07)
* `LAS 1.0 Format Standard`_ (2003-05-09)
License
------------------------------------------------------------------------------
libLAS is available under the terms of the `BSD License`_.
See `License`_ for a copy.
FAQ
------------------------------------------------------------------------------
The FAQ is available from http://liblas.org/wiki/FAQ
Features of libLAS
------------------------------------------------------------------------------
Open Source
..............................................................................
libLAS is open source software. You can embed it in your own applications
(and even resell it) as long as you follow the crediting restriction of the BSD
license.
Multiple APIs
..............................................................................
libLAS has C, C++, .NET, and Python APIs.
Spatial Reference System Support
..............................................................................
Linked against the latest version of `libgeotiff`_, you can set and get the spatial reference
systems of LAS files using simple `proj.4`_ coordinate system definitions.
Simple Variable Length Record Abstraction
..............................................................................
libLAS provides a sensible abstraction for working with variable length records (VLR)
in LAS files, and it transparently manages the VLRs related to spatial referencing
systems for you.
Command-line Utilities
..............................................................................
libLAS provides ports of the `LAStools`_ utilities by Martin Isenburg for doing
things like translating from one version of the LAS format to another, inspecting
header information, and translating LAS data to and from text.
Cross-platform operation
..............................................................................
libLAS is known to work on MSVC 7.1+ (Windows) and GCC4.1+ (OS X and Linux) platforms
on both big- and little-endian architectures.
Development
------------------------------------------------------------------------------
Authors
..............................................................................
The libLAS development team are:
* `Howard Butler`_
* `Mateusz Loskot`_
* `Phil Vachon`_
* Martin Vales
* `Frank Warmerdam`_
Special thanks to `Martin Isenburg and Jonathan Shewchuk`_ for their
`LAStools`_ pioneering implementation of the ASPRS LAS standard that made
development of the libLAS library possible.
Subversion Tree
..............................................................................
The SVN repository URL is available at http://liblas.org/svn
::
svn checkout http://liblas.org/svn/trunk/
Information about Trac
..............................................................................
* `Trac <http://trac.edgewall.org/>`_ Open Source Project
* `TracGuide <http://trac.edgewall.org/wiki/TracGuide>`_ - Built-in Documentation
* `TracFaq <http://trac.edgewall.org/wiki/TracFaq>`_ - Frequently Asked Questions
* `TracSupport <http://liblas.org/wiki/TracSupport>`_ - Trac Support
* `reStructuredText Support in Trac <http://bitten.edgewall.org/wiki/WikiRestructuredText>`_
Community
------------------------------------------------------------------------------
IRC
..............................................................................
Find the libLAS developers on IRC on #liblas at `Freenode`_.
Mailing Lists
..............................................................................
* liblas-devel - http://mail.hobu.net/mailman/listinfo/liblas-devel
* liblas-commits - http://mail.hobu.net/mailman/listinfo/liblas-commits
.. _`LIDAR`: http://en.wikipedia.org/wiki/LIDAR
.. _`IGSB`: http://www.igsb.uiowa.edu/
.. _`Martin Isenburg`: http://www.cs.unc.edu/~isenburg/
.. _`LAStools`: http://www.cs.unc.edu/~isenburg/lastools/
.. _`Martin Isenburg and Jonathan Shewchuk`: http://www.cs.unc.edu/~isenburg/lastools/
.. _`LAS Format`: http://www.lasformat.org/
.. _`LAS 2.0 Format Standard`: http://liblas.org/raw-attachment/wiki/WikiStart/incitsl1_las_format_v20.pdf
.. _`LAS 1.2 Format Standard`: http://liblas.org/raw-attachment/wiki/WikiStart/LAS1_2_Final.pdf
.. _`LAS 1.1 Format Standard`: http://liblas.org/raw-attachment/wiki/WikiStart/asprs_las_format_v11.pdf
.. _`LAS 1.0 Format Standard`: http://liblas.org/raw-attachment/wiki/WikiStart/asprs_las_format_v10.pdf
.. _`ASPRS Standards Committee`: http://www.asprs.org/society/divisions/ppd/standards/standards_comm.htm
.. _`Howard Butler`: http://hobu.biz
.. _`Mateusz Loskot`: http://mateusz.loskot.net
.. _`Phil Vachon`: http://www.geoscan.info
.. _`Frank Warmerdam`: http://home.gdal.org/warmerda/
.. _`BSD license`: http://www.opensource.org/licenses/bsd-license.php
.. _`LAS Format Elements`: http://liblas.org/wiki/LASElements
.. _`Tutorials`: http://liblas.org/wiki/Tutorial
.. _`Software`: http://liblas.org/wiki/Software
.. _`Resources`: http://liblas.org/wiki/Resources
.. _`License`: http://liblas.org/wiki/License
.. _`las2las`: http://liblas.org/browser/trunk/doc/las2las.txt
.. _`las2txt`: http://liblas.org/browser/trunk/doc/las2txt.txt
.. _`lasinfo`: http://liblas.org/browser/trunk/doc/lasinfo.txt
.. _`lasmerge`: http://liblas.org/browser/trunk/doc/lasmerge.txt
.. _`txt2las`: http://liblas.org/browser/trunk/doc/txt2las.txt
.. _`Freenode`: http://freenode.net
.. _`Library Design`: http://liblas.org/wiki/LibraryDesign
.. _`FOSS4G 2008`: http://liblas.org/raw-attachment/wiki/WikiStart/liblas_foss4g_2008.pdf
.. _`LAS C API`: http://liblas.org/doxygen/liblas_8h.html
.. _`LAS Doxygen Docs`: http://liblas.org/doxygen/
.. _`How To Release libLAS`: http://liblas.org/wiki/HowToRelease
.. _`libgeotiff`: http://www.remotesensing.org/geotiff/geotiff.html
.. _`7/28/2008`: http://lists.maptools.org/pipermail/geotiff/2008-July/000501.html
.. _`proj.4`: http://proj.maptools.org/
.. _`GDAL`: http://www.gdal.org
.. _`OSGeo4W`: http://wiki.osgeo.org/wiki/OSGeo_Win32_Installer
.. _`dotnetLibLAS API`: http://liblas.org/wiki/dotnetapi
.. _`FOSS4G 2008`: http://liblas.org/raw-attachment/wiki/WikiStart/liblas_foss4g_2008.pdf
\ No newline at end of file
This diff is collapsed.
if GDAL_IS_CONFIG
GDAL_CPPFLAGS = @GDAL_INC@ -DHAVE_GDAL=1
endif
AM_CPPFLAGS = $(GDAL_CPPFLAGS) -I../include/liblas/capi -I../include
lasinfo_SOURCES = lasinfo.c lascommon.c
las2las_SOURCES = las2las.c lascommon.c
lasmerge_SOURCES = lasmerge.c lascommon.c
las2txt_SOURCES = las2txt.c lascommon.c
txt2las_SOURCES = txt2las.c
bin_PROGRAMS = lasinfo las2las lasmerge las2txt txt2las
if GDAL_IS_CONFIG
las2ogr_SOURCES = las2ogr.cpp
bin_PROGRAMS += las2ogr
endif
LDADD = ../src/liblas.la
This diff is collapsed.
This diff is collapsed.
// $Id: las2ogr.cpp 884 2008-09-26 18:04:27Z mloskot $
//
// las2ogr translates LAS file to OGR datasource.
// Inspired by pylas.py script developed by Matthew Perry and Carl Anderson,
// available at http://code.google.com/p/pylas/
//
// (C) Copyright Mateusz Loskot 2008, mateusz@loskot.net
// Distributed under the BSD License
// (See accompanying file LICENSE.txt or copy at
// http://www.opensource.org/licenses/bsd-license.php)
//
#ifdef HAVE_GDAL
#if defined(_MSC_VER) && defined(USE_VLD)
#include <vld.h>
#endif
// liblas
#include <liblas/liblas.hpp>
#include <liblas/laspoint.hpp>
#include <liblas/lasreader.hpp>
#include <liblas/cstdint.hpp>
// ogr
#include <ogr_api.h>
//std
#include <algorithm>
#include <fstream>
#include <iostream>
#include <stdexcept>
#include <string>
#include <cassert>
// Anonymous namespace for local definitions
namespace {
template <typename T>
class ogr_wrapper
{
typedef void(*deleter_type)(T p);
public:
ogr_wrapper(T p, deleter_type d)
: p_(p), del_(d)
{}
~ogr_wrapper()
{
do_delete(p_);
}
void reset(T p)
{
do_delete(p_);
p_= p;
}
operator T()
{
return get();
}
T get() const
{
return p_;
}
void swap(ogr_wrapper& other)
{
std::swap(p_, other.p_);
}
private:
ogr_wrapper(ogr_wrapper const& other);
ogr_wrapper& operator=(ogr_wrapper const& rhs);
void do_delete(T p)
{
assert(del_);
if (0 != p)
del_(p);
}
T p_;
deleter_type del_;
};
bool term_progress(std::ostream& os, double complete)
{
static int lastTick = -1;
int tick = static_cast<int>(complete * 40.0);
tick = std::min(40, std::max(0, tick));
// Have we started a new progress run?
if (tick < lastTick && lastTick >= 39)
lastTick = -1;
if (tick <= lastTick)
return true;
while (tick > lastTick)
{
lastTick++;
if (lastTick % 4 == 0)
os << (lastTick / 4) * 10;
else
os << ".";
}
if( tick == 40 )
os << " - done.\n";
else
os.flush();
return true;
}
OGRFieldDefnH create_field(const char* name, OGRFieldType type, int width, int precision)
{
OGRFieldDefnH fld;
fld= OGR_Fld_Create(name, type);
OGR_Fld_SetWidth(fld, width);
OGR_Fld_SetPrecision(fld, precision);
return fld;
}
void create_layer_def(OGRLayerH lyr)
{
assert(0 != lyr);
std::string fldname("return_num");
OGRFieldDefnH fld = create_field("return_num", OFTInteger, 10, 0);
OGRErr err = OGR_L_CreateField(lyr, fld, 0);
if (OGRERR_NONE != err)
{
throw std::runtime_error("return_num field creation failed");
}
OGR_Fld_Destroy(fld);
fld = create_field("angle", OFTInteger, 10, 0);
err = OGR_L_CreateField(lyr, fld, 0);
if (OGRERR_NONE != err)
{
throw std::runtime_error("angle field cration failed");
}
OGR_Fld_Destroy(fld);
fld = create_field("intensity", OFTInteger, 10, 0);
err = OGR_L_CreateField(lyr, fld, 0);
if (OGRERR_NONE != err)
{
throw std::runtime_error("intensity field cration failed");
}
OGR_Fld_Destroy(fld);
fld = create_field("asprsclass", OFTInteger, 10, 0);
err = OGR_L_CreateField(lyr, fld, 0);
if (OGRERR_NONE != err)
{
throw std::runtime_error("asprsclass field creation failed");
}
OGR_Fld_Destroy(fld);
fld = create_field("return_tot", OFTInteger, 10, 0);
err = OGR_L_CreateField(lyr, fld, 0);
if (OGRERR_NONE != err)
{
throw std::runtime_error("return_tot field creation failed");
}
OGR_Fld_Destroy(fld);
fld = create_field("gpstime", OFTReal, 10, 0);
err = OGR_L_CreateField(lyr, fld, 0);
if (OGRERR_NONE != err)
{
throw std::runtime_error("gpstime field cration failed");
}
OGR_Fld_Destroy(fld);
}
void report_ogr_formats(std::ostream& os)
{
os << "Supported OGR formats:";
for (int i = 0; i < OGRGetDriverCount(); ++i)
{
OGRSFDriverH drv = OGRGetDriver(i);
assert(0 != drv);
if (OGR_Dr_TestCapability(drv, ODrCCreateDataSource))
{
os << "\n - " << OGR_Dr_GetName(drv);
}
}
os << "\nMore details at http://gdal.org/ogr/ogr_formats.html" << std::endl;
}
void usage()
{
std::cerr << "Usage: las2ogr OPTIONS\nOptions are:\n"
<< "\t-h print this message\n"
<< "\t-i <infile>\tinput ASPRS LAS file\n"
<< "\t-o <outfile>\toutput file\n"
<< "\t-f <format>\tOGR format for output file\n"
<< "\t-formats\tlist supported OGR formats\n";
}
} // anonymous namespace
int main(int argc, char* argv[])
{
int rc = 0;
try
{
OGRRegisterAll();
// Parse command-line options
std::string in_file;
std::string out_file;
std::string out_frmt;
{
int on_arg = 1;
while (on_arg < argc)
{
std::string arg(argv[on_arg]);
if (arg == "-h")
{
usage();
return 0;
}
else if (arg == "-formats")
{
report_ogr_formats(std::cout);
return 0;
}
else if (arg == "-i" && (on_arg + 1 < argc))
{
++on_arg;
assert(on_arg < argc);
in_file = argv[on_arg];