1
0
Fork 0

raw2ascii, demchop, and SRTM-30 are obsolete.

This commit is contained in:
Scott Giese 2019-01-27 12:25:12 -06:00
parent ba4d58675a
commit 0739823db6
8 changed files with 17 additions and 175 deletions

48
README
View file

@ -46,56 +46,26 @@ Preprocessing Terrain
TerraGear supports several terrain data sources:
1. 30-arcsec SRTM based terrain data covering the world (recommended
over other 30-arcsec data sources):
1. [Preferred] SRTM (version 3):
Void filled, 1-arc-sec and 3-arc-sec, near worldwide coverage.
ftp://edcsgs9.cr.usgs.gov/pub/data/srtm/SRTM30/
https://e4ftl01.cr.usgs.gov/MEASURES/SRTMGL1.003/
I don't recall the details at the moment for processing this data.
Probably similar to the processing of the GLOBE data.
2. 30-arcsec world wide data: GLOBE project:
http://www.ngdc.noaa.gov/seg/topo/globe.shtml
a) First convert the "bin" DEM format to "ascii" DEM format using
"Prep/DemRaw2ascii/raw2ascii"
b) Then process the resulting files with "Prep/DemChop/demchop"
a) Chop up each .zip files using "Prep/DemChop/hgtchop"
3. 30-arcsec world wide data: GTOPO30 data:
http://edcwww.cr.usgs.gov/landdaac/gtopo30/gtopo30.html
a) First convert the "bin" DEM format to "ascii" DEM format using
"Prep/DemRaw2ascii/raw2ascii"
b) Then process the resulting files with "Prep/DemChop/demchop"
4. SRTM (version 1 & 2) (1 and 3-arcsec nearly world wide coverage):
2. SRTM (version 1 & 2):
May contain voids, 1-arc-sec and 3-arc-sec, near worldwide coverage.
ftp://edcsgs9.cr.usgs.gov/pub/data/srtm/
a) Chop up each .zip files using "Prep/DemChop/hgtchop"
5. 3-arcsec ASCII DEM files:
Generally, I recommend using the SRTM data over this older data
set, however in places like Alaska, there is no SRTM coverage so
this data is better than the 30 arcsec data.
http://edcwww.cr.usgs.gov/doc/edchome/ndcdb/ndcdb.html
a) Create the .arr.gz files using the "Prep/DemChop/demchop" utility.
The result for any of these terrain sources should be a "work" tree
with a .arr.gz file for each FG tile.
6. SRTM data comes with 'voids'. These are areas where their
3. SRTM versions 1 & 2 come with 'voids'. These are areas where their
automated data processing system could not reliably determine the
elevation. Often this happens over water, or over mountain peaks.
There is a big chunk of the Grand Canyon missing, a big chunk of
@ -106,13 +76,13 @@ with a .arr.gz file for each FG tile.
I half trust is the USGS 3 arcsec DEM data for the USA. So we
can't fix voids outside the USA right now.
In the same directory as DemChop and HgtChop there is a "fillvoids"
In the same directory as HgtChop there is a "fillvoids"
program. You might wish to run it with something like the
following command line:
find /export/fgfs05/curt/Work/SRTM2-North_America3 -name '*.arr.gz' -exec ./fillvoids {} /stage/fgfs05/curt/Work/USGS-DEM-USA-3 \;
7. After you create the .arr.gz files you have to create a
4. After you create the .arr.gz files you have to create a
corresponding .fit.gz file for each of these. This is a data
reduction step which fits a set of polygons to the raw terrain with
a set of constraints on the maximum error allowed relative to the

View file

@ -23,7 +23,6 @@ under Windows. If running the tools from the standard Win32 command
prompt a lot of the tools have problems with directory creation - with
the tools that try to create many subdirectories this can be a major
problem. It is much better to run the tools from a Cygwin bash shell
- in this case only raw2ascii has a directory creation problem - the
output directory specified on the command line needs to be manually
created.
- the output directory specified on the command line needs to be
manually created.

View file

@ -21,24 +21,18 @@ Preparation and Preprocessing
1) DEM data.
As the first step you have to download DEM for the area you need. (You
can get them from USGS site). If this is a 30 arc sec DEM (which is most
probable) you need to transfer this file into ASCII format using
raw2ascii
can get them from USGS site).
Usage: ./raw2ascii <input_file_basename> <output_dir>
Here output dir is quite arbitrary as we will remove all the files from
it later.
Then you have to chop files that we got into the tiles used for the
scenery generation. You should use demchop for this. As we already have
scenery generation. You should use hgtchop for this. As we already have
a number of files I'm using the following Perl script
#--------------------------------------------------------------------------
#!/usr/bin/perl
my @files=glob("./*.dem");
my @files=glob("./*.hgt");
my $size=@files;
for (my $i=0;$i<$size;$i++) {
system("demchop $files[$i] /home/anovikov/w020n90/Work/DEM-30");
system("hgtchop $files[$i] /home/anovikov/w020n90/Work/SRTM-3");
}
#--------------------------------------------------------------------------

View file

@ -1,15 +1,5 @@
include_directories(${PROJECT_SOURCE_DIR}/src/Lib/terragear)
add_executable(demchop demchop.cxx)
target_link_libraries(demchop
DEM
${ZLIB_LIBRARY}
${SIMGEAR_CORE_LIBRARIES}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES})
install(TARGETS demchop RUNTIME DESTINATION bin)
add_executable(hgtchop hgtchop.cxx)
target_link_libraries(hgtchop

View file

@ -1,104 +0,0 @@
// demchop.cxx -- chop up a dem file into it's corresponding pieces and stuff
// them into the workspace directory
//
// Written by Curtis Olson, started March 1999.
//
// Copyright (C) 1997 Curtis L. Olson - http://www.flightgear.org/~curt
//
// 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id: demchop.cxx,v 1.13 2004-11-19 22:25:51 curt Exp $
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <simgear/compiler.h>
#include <chrono>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <simgear/bucket/newbucket.hxx>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx>
#include <DEM/dem.hxx>
using std::endl;
using std::cout;
using std::string;
int main(int argc, char **argv) {
sglog().setLogLevels( SG_ALL, SG_WARN );
if ( argc != 3 ) {
SG_LOG( SG_GENERAL, SG_ALERT, "Usage " << argv[0] << " <dem_file> <work_dir>" );
return EXIT_FAILURE;
}
auto start_time = std::chrono::high_resolution_clock::now();
string dem_name = argv[1];
string work_dir = argv[2];
SGPath sgp( work_dir );
sgp.append( "dummy" );
sgp.create_dir( 0755 );
TGDem dem(dem_name);
dem.parse();
dem.close();
SGGeod min = SGGeod::fromDeg(dem.get_originx() / 3600.0 + SG_HALF_BUCKET_SPAN,
dem.get_originy() / 3600.0 + SG_HALF_BUCKET_SPAN);
SGGeod max = SGGeod::fromDeg( (dem.get_originx() + dem.get_cols() * dem.get_col_step()) / 3600.0 - SG_HALF_BUCKET_SPAN,
(dem.get_originy() + dem.get_rows() * dem.get_row_step()) / 3600.0 - SG_HALF_BUCKET_SPAN );
SGBucket b_min( min );
SGBucket b_max( max );
if ( b_min == b_max ) {
dem.write_area( work_dir, b_min );
} else {
SGBucket b_cur;
int dx, dy, i, j;
sgBucketDiff(b_min, b_max, &dx, &dy);
cout << "DEM file spans tile boundaries" << endl;
cout << " dx = " << dx << " dy = " << dy << endl;
if ( (dx > 20) || (dy > 20) ) {
cout << "somethings really wrong!!!!" << endl;
return EXIT_FAILURE;
}
for ( j = 0; j <= dy; j++ ) {
for ( i = 0; i <= dx; i++ ) {
b_cur = b_min.sibling(i, j);
dem.write_area( work_dir, b_cur );
}
}
}
auto finish_time = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = finish_time - start_time;
std::cout << std::endl << "Elapsed time: " << elapsed.count() << " seconds" << std::endl << std::endl;
return EXIT_SUCCESS;
}

View file

@ -1,7 +0,0 @@
#! /bin/bash
WORKDIR=$HOME/workdirs/world_scenery
for f in $WORKDIR/SRTM-30-ASCII/*/*.dem; do
demchop $f $WORKDIR/SRTM-30
done

View file

@ -275,7 +275,7 @@ void usage(char* progname, const std::string& msg) {
SG_LOG(SG_GENERAL,SG_INFO, "will produce a better surface approximation.");
SG_LOG(SG_GENERAL,SG_INFO, "");
SG_LOG(SG_GENERAL,SG_INFO, "The input file must be a .arr.gz file such as that produced");
SG_LOG(SG_GENERAL,SG_INFO, "by demchop or hgtchop utils.");
SG_LOG(SG_GENERAL,SG_INFO, "by the hgtchop utility.");
SG_LOG(SG_GENERAL,SG_INFO, "");
SG_LOG(SG_GENERAL,SG_INFO, "Force will overwrite existing .arr.gz files, even if the input is older");
SG_LOG(SG_GENERAL,SG_INFO, "");

View file

@ -184,7 +184,7 @@ def usage(msg=''):
sys.stderr.write("will produce a better surface approximation.\n")
sys.stderr.write("\n")
sys.stderr.write("The input file must be a .arr.gz file such as that produced\n")
sys.stderr.write("by demchop or hgtchop utils.\n")
sys.stderr.write("by the hgtchop utility.\n")
sys.stderr.write("\n")
sys.stderr.write("**** NOTE ****:\n")
sys.stderr.write("If a directory is input all .arr files in directory will be\n")