[Liblas-devel] Stackable filters and transformers
Howard Butler
hobu.inc at gmail.com
Wed May 19 09:36:16 EDT 2010
All,
A very common operation that people want to do is to filter and transform LAS data as it is being read from the file. Common tasks that people want to do include things like:
* filter only points with the last return
* filter only points that are classified ground
* filter only points within a specific set of geographic bounds
* reproject data from one coordinate system to another
* translate x/y/z values
* ...
libLAS has historically had no way to do these operations other than to require you to get the data you want and then filter/transform the data as you need. Reprojection is currently a special case of the reader and writer implementations, and any other sort of transformation operation requires you to copy plenty of data around.
To that end, I have embarked on implementing filters and transforms to libLAS. They are currently C++ -only, and will likely stay that way for this upcoming release. FilterI and TransformI are to be two abstract classes that each have a single method:
http://hg.liblas.org/main/file/5586d2510818/include/liblas/liblas.hpp#l186
bool filter(const Point& p)
bool transform(Point& p)
The liblas::Reader and liblas::Writer classes will then get two methods added to them:
SetFilters(std::vector<liblas::FilterI*> filters);
SetTransforms(std::vector<liblas::TransformI*> transforms);
and will apply those operations (in the order they are defined in the vector) as they are reading/writing the data.
FilterI is done and seems to be working well. I have created two concrete implementations, one to filter classifications, and the other to filter bounds, and I have implemented them in a new version of las2las (las2las2 for now) that uses them exclusively:
http://hg.liblas.org/main/file/5586d2510818/apps/las2las2.cpp
http://hg.liblas.org/main/file/5586d2510818/include/liblas/lasfilter.hpp
http://hg.liblas.org/main/file/5586d2510818/src/lasfilter.cpp
I'd be interested to hear any thoughts or design ideas related to this topic. Otherwise, I will continue to plow ahead.
Thanks,
Howard
More information about the Liblas-devel
mailing list