Hope this helps,
Nick
> --
> Download LAStools at
> http://lastools.org/
> Visit the LAStools group at
> http://groups.google.com/group/lastools/
> Be social with LAStools at
> http://www.facebook.com/LAStools
> http://www.twitter.com/LAStools
OK, I just spent 30 min writing a tiny perl script which should do the
conversion for you (I haven't done any debugging, not even to check that
it runs, caveat emptor!)
#!perl -w
my ($ncols, $nrows, $xllcorner, $yllcorner, $nodata, $cy, $cx0) = ();
my $body = 0;
while (<>) {
chomp;
if (/NCOLS\s+(\d+)\s*$/) {
$ncols = $1;
}
elsif (/NROWS\s+(\d+)\s*$/) {
$nrows = $1;
}
elsif (/CELLSIZE\s+(\d+)\s*$/) {
$cellsize = $1;
}
elsif (/XLLCENTER\s+(\d+)\s*$/) {
$xllcenter = $1;
}
elsif (/YLLCENTER\s+(\d+)\s*$/) {
$yllcenter = $1;
}
elsif (/XLLCORNER\s+(\d+)\s*$/) {
$xllcorner = $1;
}
elsif (/YLLCORNER\s+(\d+)\s*$/) {
$yllcorner = $1;
}
elsif (/^\s*\d+/) { # A row of height data, convert and dump to output!
if !defined($xllcorner) {
$xllcorner = $xllcenter - ($ncols-1)*0.5*$cellsize;
}
if !defined($yllcorner) {
$yllcorner = $yllcenter - ($nrows-1)*0.5*$cellsize;
}
if !defined($cy) {
$cy = $yllcorner + ($nrows-1)*$cellsize;
$cx0 = $xllcorner;
}
my @row = split;
my $cx = $cx0;
foreach (@row) {
printf("%s %s %s\n", $cx, $cy, $cx);
$cx += $cellsize;
}
$cy += $cellsize;
}
}
--
- <Terje.M...@tmsw.no>
"almost all programming can be viewed as an exercise in caching"
| Wildca...@gmail.com
Sent by: last...@googlegroups.com 03/27/2012 11:28 AM
|
|