tin2dem
This program takes a streaming mesh as input and produces a
raster grid in the specified format and resolution as output
by rastering linearly interpolated triangles as they stream
in. The interpolated value is either the elevation at that
point or the intensity of a diffuse reflection based on the
specified light direction (i.e. "hillside shading").
The currently supported output formats are *.jpg, *.png, and
*.bil (with *.hdr and *.blw files). The jpg and png rasters
are typically 8 bit greyscale with JPG turning no data areas
black while png leaving them transparent. They usually will
represent either a hillside shading or a false elevation
coloring. The BIL writer supports 16 bit and 32 resolution
integers that will usually hold an an elevation value in
feet or meter. There may be a few untested / unimplemented
combinations. Please email bug reports to
isenburg@cs.unc.edu
We have also been adding support for several interpolation schemes. We currently support linear, quadratic, (ESRI's) quintic interpolation, and Chui's interpolatory
SubdivisionSurfaces over each triangle.
Example usage:
>> tin2dem -i ../data/PIE_0015_simp.smb -o ../data/PIE_0015.png
Scan converts a streaming mesh (that is supposed to be a TIN or
a triangulated terrain with the elevation along the z axis) into
a raster image in PNG format. The default will raster the entire
extend of the bounding box using one pixel per unit using hillside
shading with a default light source direction (1,1,2) and smooth
surface normals computed at the vertices of the mesh. It also kills
poorly shaped triangles (that have an edge longer than 50 units)
>> tin2dem -i ../data/PIE_0015_simp.smb -o ../data/PIE_0015.png -elevation_coloring
Same as above but the pixels of the PNG image are colored based on the
elevation at the point instead of based on the angle between light and
surface normal. Pixels at the lowest point of the terrain get
color 0, while those at the highest point get color 255.
>> tin2dem -i ../data/PIE_0015_simp.smb -o ../data/PIE_0015.jpg -kill 25 -step 2
Same as the first but with the output being in JPEG format, one pixel
for every two units and with killing all triangles that have an edge
longer than 25 units.
>> tin2dem -i ../data/PIE_0015_simp.smb -o ../data/PIE_0015.png -stateplane83 MA_M
Same as the first but also creates a KML file called ../data/PIE_0015.kml
so we can view the PNG correctly geo-referenced inside Google Earth. We
specified the projection as the NAD83 datum, Massachusetts State Plane
Mainland Zone coordinate system.
>> tin2dem -i ../data/TO_core_last_cityhall.smb
If called without any other arguments it will simply read the entire
file and compute and output the number of vertices and triangles and
the extent of the bounding box.
>> tin2dem -i ../data/TO_core_last_cityhall.smb -o ../data/TO_core_last_cityhall.png -step 0.5
Generates a PNG raster from a TIN of Toronto's city hall using one pixel
per half unit and hillside shading.
>> tin2dem -i ../data/TO_core_last_cityhall.smb -o ../data/TO_core_last_cityhall.png -step 0.5 -elevation_coloring
Same as above but with elevation coloring.
>> tin2dem -i ../data/TO_core_last_cityhall.smb -o ../data/TO_core_last_cityhall.png -step 0.25 -ll 630270 4834620 -ncols 370 -nrows 330
Same as above but instead of rastering the entire bounding we start at the lower left corner
630270 4834620 and raster an 370 x 330 image from there with a step size of 0.25. These
settings focus on the city hall building.
>> tin2dem -i ../data/TO_core_last_cityhall.smb -o ../data/TO_core_last_cityhall.png -step 0.25 -ll 630270 4834620 -ncols 370 -nrows 330 -ellipsoid 11 -utm_zone 17T
Same as above but also creates a KML file called ../data/TO_core_last_cityhall.kml
so we can view the PNG correctly geo-referenced inside Google Earth. We
specified the projection as UTM zone 11S and the GRS 1980 (NAD-83) ellipsoid.
>> tin2dem -i ../data/TO_core_last_cityhall.smb -opng -tiling_ns "../data/cityhall" 400 -step 0.25 -ellipsoid 11 -utm_zone 17T
Creates a tiling of the entire cityhall data set with 400x400
pixel tiles and a KML file that georeferences everything.
>> tin2dem -ellipsoid -1
Lists all the supported ellipsoids.
>> tin2dem -i ../data/PIE_0015_simp.smb -o ../data/PIE_0015_simp.bil
Creates a DEM in BIL format. In addition to PIE_0015_simp.bil the files
PIE_0015_simp.hdr and PIE_0015_simp.blw are created. Use, for example,
the free ER viewer to look at the resulting files. The default is to
create a BIL with 16 bit precision and a no data value of -9999. Note
that in default mode each raster is given the
actual elevation at that
point quantized to a 16 bit integer (when creating PNG of JPG rasters
elevations are scaled into the 0 ... 255 range).
>> tin2dem -i ../data/PIE_0015_simp.smb -o ../data/PIE_0015_simp.bil -nodata -99 -elevation_scale 10
Same as last but the no data value is now -99 and the elevations are
multiplied by 10 before being quantized to a 16 bit integer. This is
useful to preserve accuracy to a tenth of a meter (or foot) rather
than just to a meter (or foot).
>> tin2dem -i ../data/PIE_0015_simp.smb -o ../data/PIE_0015_simp.bil -nodata -99 -elevation_scale 100 -nbits 32
Same as last but with each raster being a 32 bit integer and the
accuracy being preserved to a hundredth of a meter (or foot).
Other options include:
-lcc, -lambert, -lambert_conic_conformal: specify an LCC projection
-tm, -traverse, -traverse_mercator: specify a TM projection
-survey_feet, -survey_foot, -surveyfeet, -surveyfoot, -surveyft, -sft: horizontal coordinates are in survey feet
-feet, -foot, -ft: horizontal coordinates are in feet
-meter, -met, -m: horizontal coordinates are in meter (default)
-elevation_feet, -elevation_foot, -elevation_ft, -elev_feet, -elev_foot, -elev_ft: elevation is in feet
-elevation_meters, -elevation_meter, -elevation_m, -elev_meters, -elev_meter, -elev_m: elevation is in meter (default)
-elevation_offset , -elev_offset : add an elevation offset in meters
-quality <0..100>: compression quality for JPEG images
For more info:
>> tin2dem -h
usage:
tin2dem -i tin.smb -o grid.png -ncols 1000 -nrows 1000
tin2dem -ismb -o grid.jpg -step 2 -quality 90 < tin.smb
tin2dem -i tin.sma -o grid.png -step 1 -stateplane83 MA_M
tin2dem -i tin.sma -o grid.png -step 1 -quality 90 -utm_zone 11S -ellipsoid 11
tin2dem -i tin.smb -o grid.bil -step 2 -ll 1930000 390000
tin2dem -i tin.smb -opng -step 0.5 -tiling_ns ../tiles/grid 100
tin2dem -h
More info for some flags:
-lambert_conic_conformal [meter|feet|surveryfeet] <1stStdParallel> <2ndStdParallel>
-traverse_mercator [meter|feet|surveryfeet]
-stateplane83 IA_N
-stateplane27 IA_S
-quality 60
-ll
-tiling_ns
If you find bugs let us know. (
isenburg@cs.unc.edu)
--
JackSnoeyink - 01 Jun 2008
to top