<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> Programming dem files , By, Laurence Mehlhorn

                            

                                                                                                                                                             By: Laurence Mehlhorn

MAIN INDEX

1:DEM FILES _ a nasa breakdown

2: Download The Script Elevation generator For Blender 3d.

3: Download Python To run the Elevation Generator script.

........It is next important to understand standard dem files ect. So After Downloading the program script elevation generator read over the overview on srtm below to understand how this program works. a

A FAST EXAMPLE.                                                                                                      " below a preview"

Get a free copy of Blender 3D

                                                                                                                          

       1: STEP ONE DOWNLOAD BLENDER 3D TO START.                                                     

       2: SEARCH ON THE INTERNET FOR FREE DEM FILES.                                 

       3: DOWNLOAD AND SAVE THE DEM FILE IN A BLENDER PROJECT FOLDER.

       4: RUN THE PYTHON SCRIPT BY LOADING THE SCRIPT IN BLENDER.

       5; IMPORT THE DEM FILE.

      6: AT THIS POINT, THERE WILL BE THE AREA GENERATED BY THE SCRIPT.

      7: ADD ANIMATION TO CAMERA USING A PATH ANIMATION TO FLY THROUGH THE AREA, OR USE THE GAME ENGINE TO CREATE A EXECUTABLE FILE : ADD KEY MOVEMENT TO THE CAMERA FOR VIRTUAL FLYOVER OF AREA.

GOOD LUCK: PLEASE RETURN FOR A VIDEO TUTORIAL ON THIS PROCEDURE. IT IS IMPORTANT TO NOTE THE PROFICIENCY IN BLENDER 3D IS NEEDED.

 

.....It is important to go to the blender site and read over the instructions for installing Python to work in conjunction with blender. Go to the Game programming site ? Tutorials / Documentation / Python. There you will find how to install Python to work in conjunction with blender, Without a proper installation this program will not work.

.Below A Real working model in Blender software obtainable with the following script.................................................................

Documentation / SRTM Generator Script / Program Instructions.

Preface
This is the documentation of the Blender DEM importer python script.
Script Version: 0.0.4
Documentation version: 2
Goal of the script is the generation of a Blender grid mesh whose vertexes reflect the elevation data of


earth surface, contained within a SRMT or GTOPO format file.
Currently the script could be used to generate a “flat mesh” representing a part of “real” landscape.
Generated mesh is a grid of vertexes equally distanced along X and Y axis: the Z coordinate of vertexes
reflect to the landscape elevation corresponding to the specific latitude and longitude of the point.
Installation
Distribution content
Script distribution is made through a zip/tgz file.
Every distribution contains the following files:
– DEM_import_x.y.z.blend
The blender file including the importer (as a text object)
– DEM_import_x.y.z.py
The python script (to be eventually placed inside the script directory)
– DEM_import_ita_x.y.z.pdf
this documentation (localized in italian)
– DEM_import_eng_x.y.z.pdf
this documentation (in english)
– GPL_License.txt
license copy
A fresh complete copy of the latest script version is available from:
http://uaraus.altervista.org/
and following the links to blender and DEM importer.
Installation
The script could be invoked in two ways:
1. though the .blend file.
open the blender file included within the zipfile and pressing ALT+P from text window
2. through scripts menu.
this latter way it's a little bit trickier, because it's needed to copy the .py file inside the script directory
where blender locates its own “standard” python extensions.
In the following a little explanation on how to discover this directory (skip if you already can figure it
out). The straightforward method is invoking bender from the command line with the -d switch:
# blender -d


Blender will verbosely print out what's doing on startup. Locate the following lines:
Getting menu data for scripts from dir(s):
\path\scripts
Blender Digital Elevation Model importer 0.0.4 1/7
Blender Digital Elevation Model importer
© 2005 U (Antonio Ospite) and uaraus (Alessandro Pirovano), released
under GNU GPL 2 license
if found, blender is telling you which is the directory where to copy the script;
sometimes you could find the following lines, instead:
Getting menu data for scripts from file:
\path\Bpymenus
and in this case blender is reading the configuration from a cache file: to find the directory you have
to substitute the latter Bpymenus with scripts.
So, close blender, copy the script in the found directory, delete (or give a new name) to Bpymenus
file, that will be automagically rebuilt at blender start-up
System requirements
The script has been developed with Blender 2.36 and Python 2.3.4: the script requires a full fledged
python installation to work.
Digital Elevation Model
Digital Elevation Models (DEM) are representation, as files, of elevation data of earth surface: they are a
sort of digital maps of earth.
Elevation data are organized in several files where is possible to recall latitude, longitude and elevation
coordinates for every point of the earth surface (well, almost any point...).
Currently the DEM importer script could read SRTM3 format data files, and possibly in a future release
GTOPO30 data files.
SRTM data (Shuttle Radar Topography Mission) have been acquired through a synthetic aperture radar
installed on board of Endeavour Space Shuttle, during the 11 days mission STS-99 launched on feb.2000.
Topographic data has been collected for dry lands (excluding water masses) between 56 deg. latitude
South and 60 deg. latitude North, covering about 80% of the total.
Gathered data have been processed and organized in
segments covering 1 deg. latitude by 1 deg
longitude.
Every segment has been saved in a distinct file:
every file is organized as a grid of 1201 rows by 1201
columns of samples whose distance is 3 arc seconds
(1/3600 of degree) both in latitude and in longitude.
The rows on North and South border, as well as
columns on East and West border, will be identical
(and consequently will overlap) to rows/columns of
adjacent file borders.
One arc second measured at equator, corresponds
approximately to 30 meters, so two sampling points
are distant roughly 90 meters from each other.
This is obviously an approximation that will rapidly
“deteriorate” considering sampling points distant
from the equator: so a flat representation of
landscape introduces a distortion that is higher the
more we will move towards the poles.
Conventionally file names (having a .HGT extension) recall the latitude and the longitude of the
geometrical sample located in the “lower left corner” of the segment contained within the file.
For example, the file N40W118 will contain the samples going from longitude 40 deg. North to 41 deg.
North and from latitude 118 West to 117 West.
Headers or trailers are NOT included within the files : they are composed of the “dry” samples sequence.
Every sample is represented with a 16 bit signed integer, row ordered.
Integer coding is “big endian”, so the first byte read is the most significant, the second is the less
significant. The number associated with the sample corresponds to its elevation measured in meters with
respect to the WGS84 EGM96 geoid (the geoid is a rotational solid used in geodesy, that approximates
Blender Digital Elevation Model importer 0.0.4 2/7
Fig. 1 .HGT file structure
the shape of the earth better than a sphere or an ellipsoid).
Within raw data files, freely available on internet, some “holes” in the data representation could be
present: samples corresponding to these holes is given a conventional value of -32768.
Where these data could be downloaded
SRTM3 data files could be downloaded directly from internet. from the site
ftp://e0mss21u.ecs.nasa.gov/srtm/
On this site is present a directory for
each continent, where data files are
present. As already explained there
are no data for seas and oceans.
Figure 2 represents the tiling map
for the SRTM data files: different
colors maps over the different
continents.
This is a very useful map, cause it
could allow to identify (at very high
level) which files correspond to any
given area.
Importer at work
Script start
Depending on the installation chosen, the importer script could be started in the following ways:
1. selecting it from the import script menu (and this require a little bit of installation); or ...
2. loading the .blend file and pushing ALT-P inside the text window where the script is displayed.
User Interface
The user interface has been divided in three parts, related respectively to:
– input file definitions
– mesh generation
– vertex colors association
The three parts are displayed selecting the three
corresponding toggle buttons.
Input File section
The layout of Files section is shown in figure 3.
Informations requested in this section are:
– DEM file directory
it's the name of the directory where heightmaps
files are saved. The Browse button opens the
Blender file selector, where it is possible to
navigate the directory tree.
Input file names must respect SRTM
conventions: practically (and easily) download
the files from internet and decompress them all
inside one single directory.
If specified latitude and longitude intervals span
across one or more files not present in the
directory, the script will assign a zero value
Blender Digital Elevation Model importer 0.0.4 3/7
Fig. 3 GUI – Files section
Fig. 2 Tiling map for SRTM3 DEM files
elevation to the corresponding grid vertexes: in
this case the generated mesh could have some
zero-filled parts.
This behavior allows to correctly deal with
latitude and longitude intervals that spans over
seas (and where there are no data file
available).
– File type
currently the script does not discriminate
automagically the input file type, so it is needed
the identification of the file type. By now the
only file type available is the SRTM3;
– List of suffixes
The importer have to find, within the specified
directory, the group of files whose name respect
the above explained SRTM data structure (e.g.
N15E005.HGT): it is possible, however, to
specify a list of suffixes to be placed after the
standard filename, so that the script will search,
in the order, the files:
N15E005.HGT if not found looks for ...
N15E005first_suffix.HGT if not found looks for ...
...
N15E005last_suffix.HGT if not found sets to zero the elevation of vertexes inside the corresponding
area and skip to the next area
Suffixes in the list must be comma separated.
– File extension
allow to modify the input file extension, that is set to HGT by default (omit the leading “dot”).
Mesh generation data
The layout of Data section is shown in figure 4.
Informations requested in this section are:
– Object Name
Name of object to be created. The script performs a safety check on already existing object with the
same name and, in case, alters automatically this parameter appending a trailing “x” to object name.
– Scale factor
Scale factor determines the distance between adjacent vertex of the generated mesh
– Downsampling
This parameter specifies how many samples are effectively used to determine the height of a vertex
(it's the “reduction factor” of original samples number).
Downsampling=1 means that every single sample within the input files is read and associated to a
single mesh vertex. In case of “holes” in raw data, a null elevation is given to the corresponding
vertex.
Downsampling=N means that a mesh vertex is generated for every NxN samples “tile”: all samples
are read from file and filtered to obtain the elevation of the vertex. This filtering process manages
effectively the presence of “void” data excluding them from elevation computation.
– Latitude (max – min)
Maximum and minimum value of latitude data to import
– Longitude (max – min)
Maximum and minimum value of longitude data to import
Vertex colors association
The layout of Color section is shown in figure 5.
Informations requested in this section are:
– Use colors
This toggle enables the association of colors to vertex. If not enabled, no colors are associated to
vertexes.
If enabled, a color table is shown with the associations of colors to the different height bands.
Blender Digital Elevation Model importer 0.0.4 4/7
Fig. 4 GUI - Data section
Colors are assigned through the Blender Vertex
Paint feature.
Once the mesh has been generated, a color
preview is available in the Blender 3d window
selecting the Vertex Paint from mode combobox.
To see colors during rendering it's needed to
associate a material to the mesh, then in the
material panel set the switch VcolPaint.
The table shows all the color bands defined for
the map, in descending height order (in
meters).
For example, in figure 5 are defined 5 color
bands:
• The first color is used above 1500
meters,
• the second one will be used at 1000
meters, while between 1500 and 1000 a
blend of the first and the second color, proportional to the height, will be used;
• the third one will be used at 500 meters, while between 1000 and 500, a blend of the second
and the third color, proportional to the height, will be used;
• and so on until the last color band that is used below 10 meters.
Every color band could be modified through the following sliders:
- Height
this allows to modify the height threshold of the color band. The script allows to have two colorbands
with the same height value and different colors: the first one will be used to interpolate the color
above the threshold; the second one will be used to interpolate the color below the threshold.
- R,G,B
these allow to modify the red-green-blue component value of the color. Values range from 0 to 255.
Every modification reflects in real-time on the little colored preview square drawn beside the sliders.
- Delete
this allows to delete a colorband: the topmost and lowermost colorbands cannot be deleted.
The Add new button allows to add a new colorband inserting a new height threshold corresponding to
the height specified with the associated slider.
Output Mesh
The script output is a new Blender object having the name specified in the related input parameter.
Seen from above, the mesh is a simple grid: longitude extends over the X coordinate (the East located
with increasing X), while latitude extends over the Y coordinate (the North located with increasing Y).
Quick & Dirty
1. Decide the area to import and its coordinates (latitude and longitude intervals); for this step it could
be useful to look at the globe map in figure 2;
2. Download the corresponding HGT files from internet;
3. Unzip ad move them all within a directory;
4. Start the script;
5. Insert input parameters:
- directory;
- file type;
- latitude/longitude intervals;
- downsampling (start with 8 at least);
- set (or clear) vertex color;
6. start & wait;
7. save the blend file with the new mesh.
Blender Digital Elevation Model importer 0.0.4 5/7
Fig. 5 GUI – Color section
To Do
This is the list of some possible evolutions of the script features (in no particular order).
Maybe some of them will be implemented in a future.
1. Verify congruence of horizontal/vertical scale.
2. Automatic association of a material and a texture map.
3. Void management (ever with no decimation set)
4. Enable import of GTOPO file format
5. Read data directly from zip/tar.gz (on-the-fly or cache decompress)
6. linux/win installer
7. better Object Name management
8. Estimate number of vertexes before import
9. report on height distribution within the imported dataset.
License
Script and associated documentation, are distributed according to the Gnu GPL 2 license: a copy is
included within the distribution zipfile.
Blender DEM importer
Copyright (C) 2005 U (Antonio Ospite) and uaraus (Alessandro Pirovano)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Credits
part of the code inspired by the GPLIGC package, by Hannes Krüger. For more details, his web site is :
http://pc12-c714.uibk.ac.at/GPLIGC/GPLIGC.php
Documentation generated by OpenOffice.org, Inkscape, The Gimp and (of course) Blender.
Some graphic components downloaded from the web (but don't remember where).
Earth images courtesy of http://www.space-graphics.com.
Feedback
For any information or feedback related to this script and its documentation, please write to the following
address: uaraus_dem@yahoo.it
Blender Digital Elevation Model importer 0.0.4 6/7
Releases
V 0.0.4 Fixed filename for negative Lat & Lon
Fixed progressbar
V 0.0.3 Fixed Lat & Lon sliders
GUI Rewrite with implementation of new input parameters
Management of persistent data
Updated vertex color association routine
V 0.0.2 Initial release
Blender Digital Elevation Model importer 0.0.4 7/7