[FrontPage] [TitleIndex] [WordIndex

Digital Elevation Model (DEM)

In order to have the elevation information used in the deegree 3 terrainService, one has to convert it into a specific format. The conversion tools used are XYZConverter and DEMDatasetGenerator.

1. XYZConverter

The raw elevation model information is in the form of .xyz files. One can use the XYZConverter tool to generate the needed mrindex.bin and fragments.bin files.

Note: The .xyz Files are in ASCII format and have one point per row. The X Y and Z values are separated with spaces. Like this example:

2500042 5541059 384
2500042 5541028 389
2500042 5540997 392

Assuming the files are in the ~/xyz directory, one first does an analysis of the data. In the d3_tools module one runs ant so that the build/ directory is created and the d3toolbox.sh script can be used.

./d3toolbox.sh XYZConverter -analyze -in_basedir ~/xyz -r

Analyzing XYZ files
-------------------

Analyzing file '/home/ionita/xyz/40111/40111f7.xyz'...done.
Analyzing file '/home/ionita/xyz/40111/40111f8.xyz'...done.
Analyzing file '/home/ionita/xyz/40111/40111g7.xyz'...done.
Analyzing file '/home/ionita/xyz/40111/40111g8.xyz'...done.

Results:
- input directory: /home/ionita/xyz
- number of input files: 4
- number of heixels (height values): 5857571
- domain minX: 415430
- domain minY: 4497410
- domain maxX: 436800
- domain maxY: 4525360
- domain X resolution (distance between heixels on X axis): 10
- domain Y resolution (distance between heixels on y axis): 10
- min height: 1280.5
- max height: 2919.4
- number of heixels (x-direction): 2138
- number of heixels (y-direction): 2796

using this information, one usually runs the conversion by setting the parameters to the values outputted by the analysis. The scale is set such that all height values will become integers, so in this case 10 is used. Also an output path has to be entered (here the file heixels.bin).

./d3toolbox.sh XYZConverter -convert -in_basedir ~/xyz -r -out_file /tmp/heixels.bin -max_x 436800 -max_y 4525360 -max_z 2919.4 -min_x 415430 -min_y 4497410 -min_z 1280.5 -res_x 10 -res_y 10 -scale_z 10

Converting XYZ files to raw file
--------------------------------

- input directory: /home/ionita/xyz
- number of input files: 4
- domain minX: 415430
- domain minY: 4497410
- domain maxX: 436800
- domain maxY: 4525360
- scale: 10.0
- min height: 1280.5 -> 0
- max height: 2919.4 -> 16389
- number of heixels (x-direction): 2138
- number of heixels (y-direction): 2796
- output file: /tmp/heixels.bin
- output file size: 12 MB (11955696 bytes)

Creating heixel buffer of capacity 12 MB...done.
Reading file '/home/ionita/xyz/40111/40111f7.xyz'...done.
Reading file '/home/ionita/xyz/40111/40111f8.xyz'...done.
Reading file '/home/ionita/xyz/40111/40111g7.xyz'...done.
Reading file '/home/ionita/xyz/40111/40111g8.xyz'...done.
Writing heixel file '/tmp/heixels.bin'...done.

2. DEMDatasetGenerator

The generated heixels.bin file is then used to generate the elevation-model datasets. For this, the DEMDatasetGenerator tool is used.

d3toolbox.sh DEMDatasetGenerator -default_z 0 -max_z 3000 -in_file /tmp/heixels.bin -in_x 2138 -in_y 2796 -res_x
10 -res_y 10 -offset_x 20 -offset_y 20 -in_offset 1280.5 -in_scale 0.1 -out_levels 8 -out_rows 128 -out_x 20480 -out_y
20480 -out_dir /home/ionita/utah/dem/geometry

One notices that the scale here is set to bring the data to its original scale (although in practice, using a scale of 0.01 yields more realistic results). The output_levels and out_rows values represents the number of levels/rows the tree that handles the gradual rendition should have (here the values of 8, 128 respectively have been reached by experimentation). The out_x and out_y values should be powers of 2 (here specifically 2048), multiplied by the scale (in this case 10). 2048x2048 points are close to covering the whole area (2138x2796) and has turned out a better choice than 4096x4096. Other tricky options are offset_x and offset_y, which can be set to cut the image from the (0,0) corner. The rest of the values can be determined from the XYZConverter output.

The path to the resulting files is then set in the configuration file of the deegree 3 terrainService:

...
      <wpvs:ElevationDataset>
        <wpvs:Name>dem</wpvs:Name>
        <wpvs:Title>Elevation model</wpvs:Title>
        <wpvs:Abstract>The elevation model of the city</wpvs:Abstract>
        <ds:ElevationModelDataSource>
          <ds:DataSourceName>deegree dem created with the WPVS</ds:DataSourceName>
          <ds:Directory>file:/home/ionita/utah/dem/geometry</ds:Directory>
        </ds:ElevationModelDataSource>
      </wpvs:ElevationDataset>
...


CategoryDeegree3


2018-04-20 12:04