Jul 15 2008
R is for Radiohead
Radiohead realeased their video for House of Cards yesterday. Besides being a big radiohead fan, I was also loving the LIDAR technology behind the video.
If you want to check it out yourself, there are code samples on the site as well as access to the raw data. The csv files have four columns (x, y, z, and intensity). For me the quickest way to visualize the data was through R and it’s OpenGL interface called rgl (which is a wonderful high-level 3D data visualization environment).
Assuming you have R installed, rgl is a simple add on through the CRAN repositories:
install.packages("rgl")
Then you need to load the library, load the csv, scale the intensity values from 0 to 1. Then it’s a simple rgl.points command to get an interactive 3D rendering:
library(rgl)
d < - read.csv("C:/temp/radiohead/22.csv", header=FALSE)
# scale intensity values from 0 to 1
d$int <- d[,4] / 255
# rgl.points(x,y,z,size=__,color=__)
# note y value is inverted
# color is a grayscale rgb based on intensity
rgl.points(d[,1],d[,2]*-1,d[,3], size=3, color=rgb(d$int,d$int,d$int))
That’s all it takes to render Thom Yorke in all his 3D digital glory:
Dear Matthew,
my name is Peter Zalavari. I come from Hungary and now I make an intership by Z_GIS (www.uni-salzburg.at/zgis).
I can’t write a comment on the “Geocoding an address list to shapefile” post and I can’t find your email address. That’s why I write here.
I’m working on a python script to convert text files into point shapefiles and I read on your blog, that you made a txt2shp.py. I tried to download the script, but got a 404 error. If your script is free to modify, send me please. Maybe I write a new one, but I think your script would be a good starting point for me.
Thanks!
Cheers,
Peter
Peter, you may try to use libLAS utilities (http://liblas.org/):
1. txt2las - convert your points stored in text file to LAS format
2. las2ogr - convert LAS file to regular vector in one of formats supported by OGR (http://www.gdal.org/ogr/), ESRI Shapefile included.
If you have further questions, feel free to post them to theliblas-devel mailing list (see link on liblas.org).
Mateusz