On Thu, Dec 17, 2015 at 9:18 AM, J Luis <
jmf...@gmail.com> wrote:
> Hi, I must tell you guys that I'm not a heavy (maybe not even a light one)
> LIDAR user. I this wrapper because I wanted to investigate more a fact that
> I found where xyz grids stored as laz are more than 4 times smaller than
> netCDF grids using the best deflation level. But I'm even more confused now
> because if I store just the Z vector (by cheating a bit) I don't recover the
> small grids as I do by simply converting a grid in xyz with txt2las.
Hmm, I'm afraid I don't understand your exact problem here. What are
the "small grids"?
> If any of want to try it, it can be done with this simple example (which
> uses GMT as well)
>
> using Laszip, GMT
> G = gmt("gmtread -Tg V:/002_4_13-mis_orto.grd");
> z=reshape(G.z,G.n_rows*G.n_columns,1);
> dat2las("V:/bathy.laz", z, [G.range' G.registration G.inc']);
I thought I'd try it out so I grabbed the bat_atl_30c_j.grd example.
I got GMT built, and managed to pull out data for the
http://w3.ualg.pt/%7Ejluis/mirone/misc/bat_atl_30c_j.grd.zip example,
but I got some odd ccall errors (ERROR: could not load symbol
"laszip_create":), which I suspect means my laszip doesn't have the C
interface compiled into it. After that I admit I gave up.
Nice! It's good to see glvisualize coming along.
If you're mainly interested in 3D geospatial data and want to flexibly
display rather large point clouds, you might also be interested in my
project displaz, which has an evolving julia interface. (The
interface isn't in a proper julia package yet, but you can add
https://github.com/c42f/displaz/tree/master/bindings/julia/Displaz.jl
to your julia LOAD_PATH. You'd want the Displaz.jl version from the
associated compiled version of displaz since it has changed a bit
recently. If you're on windows you can download a binary of the
latest displaz release.).
I spent a while trying to make displaz show the Atlantic bathymetry in
a nice way. I ended up with this, which was reasonably nice:
#-------------------------------------------------------------------------------
using Proj4, GMT, Colors, Displaz
function load_grd(filename)
G = gmt("gmtread -Tg $filename")
points = zeros(3, size(G.z)...)
for j=1:size(G.z,2), i=1:size(G.z,1)
points[1,i,j] = G.x[j]
points[2,i,j] = G.y[i]
points[3,i,j] = G.z[i,j]
end
G, reshape(points, 3, length(z))
end
G, points = load_grd("/home/chris/downloads/bat_atl_30c_j.grd")
#points[3,:] *= 10 # Enhance height
# This is a big chunk of the Earth's surface. Transform to ECEF for interest
wgs84 = Projection("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
+towgs84=0,0,0")
geocent = Projection("+proj=geocent +datum=WGS84 +units=m +no_defs")
points = transform(wgs84, geocent, points')' # ugh, need to fix these
transposes....
z = vec(G.z)
zmin, zmax = extrema(z)
ncols = 200
cm = map(RGB{Float32}, Colors.colormap("RdBu", ncols))
cols = cm[floor(Int, (ncols-1)*(z-zmin)/(zmax-zmin)) + 1]
plot3d(points, color=reinterpret(Float32, cols, (3, size(points2,2))))
#-------------------------------------------------------------------------------
Cheers,
~Chris