Points2Grid is a tool, written in C++, which promises to do the job in a simple intuitive way. It accepts ascii and las (lidar) formats and outputs gridded data, plus gridded data densities.
First install LIBLAS which is Lidar data translation libraries. The recommended version is 1.2.1. I installed liblas 1.6.1 because it was the oldest version on the site that had a working link. I installed this by issuing:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd libLAS-1.6.1/ | |
mkdir makefiles | |
cd makefiles | |
cmake -G "Unix Makefiles" ../ | |
make | |
sudo make install |
Make a note of where the libraries are installed. On my system: /usr/local/include/liblas/
Download points2grid from here.
In Interpolation.h, adjust MEM_LIMIT variable in the file to reflect the memory limitations of your system. From the README guide,
"As a rule of thumb, set the MEM_LIMIT to be (available memory in bytes)/55. For jobs that generate
grids cells greater than the MEM_LIMIT, points2grid goes "out-of-core", resulting in significantly worse performance."
Find this value using:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mem=$(cat /proc/meminfo | grep MemTot | awk -F" " '{print $2}') | |
echo "$mem/55" | bc |
I then had to point the code to where the liblas directories had been installed. In Interpolation.cpp, replace:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#replace | |
#include <liblas/laspoint.hpp> | |
#include <liblas/lasreader.hpp> | |
#with | |
#include </usr/local/include/liblas/liblas.hpp> | |
#include </usr/local/include/liblas/reader.hpp> | |
#replace | |
liblas::LASHeader const& header = reader.GetHeader(); | |
#with | |
liblas::Header const& header = reader.GetHeader(); | |
#replace | |
liblas::Reader reader(ifs); //liblas::LASReader reader(ifs); | |
#with | |
liblas::LASReader reader(ifs); | |
#replace | |
liblas::LASPoint const& p = reader.GetPoint(); | |
#with | |
liblas::Point const& p = reader.GetPoint(); |
It should then install with a simple 'make' command. Happy gridding!
No comments:
Post a Comment