|
|
How to convert elevation data
from ascii text into VRML elvation grid.
- You need a matrix representation of elevation points stored in ascii
format(text file). sample exported from
Arc/Info software.
- Cut-and-paste matrix into command line of Matlab.
ie." >> elevation_data = [ paste here" <-(inlcude
close bracket ']' in paste)
- Depending on your desired level of accuracy you may want to round
the matix for simplicity.
- For VRML performance considerations you will probably want to reduce
the resolution of the data. For a single elevation grid, approximately
100 x 100 elevation points yields a visually appealing scene. For most
machines today, any greater resolution will result in poor performance.
Here are Matlab script files that reduce a matrix by one-half (sample_half.m)
and one-quarter (sample_quarter.m).
- It may be helpful to know the lowest and highest points in
you data.
ie. If the lowest point in your grid is 800 units, you might want to
translate the grid by -800 so that you can view it without having to
remember to move your viewpoint and anything else up 800 units.
Use these Matlab commands:
min(min(matrix_name))
max(max(matrix_name))
- Next you want to save it to file in a format suitable to cut-and-paste
into a VRML file.
Here is the Matlab script file: formatElevData.m.
- Now that you have the new elevation matrix in text format, cut-and-paste
the data into the VRML file's ElevationGrid height field. example
- If you would like to assign colors to the elevation grid depending
on the elevation, modify and use ColorPerVertex
. (Know you data first. see 5) This script takes an elevation matrix
and writes a RGB color matrix to a text file. You need to edit this
script to define height boundaries and colors that make sense for each
elevation matrix that you pass it. See example
for where this matrix belongs in a VRML file.
- This is a prettly simple procedure but if you know of a better one,
please let me know.
Questions/Comments.
|