1
0
Fork 0

A slightly more flexible way to find the best elevation data.

This commit is contained in:
curt 2003-03-08 03:25:05 +00:00
parent e7d08d90d1
commit 887297d8d0

View file

@ -177,6 +177,13 @@ static point_list calc_elevations( const string& root,
const point_list& geod_nodes, const point_list& geod_nodes,
double offset ) double offset )
{ {
string_list elev_src;
elev_src.clear();
elev_src.push_back( "SRTM-1" );
elev_src.push_back( "SRTM-3" );
elev_src.push_back( "DEM-3" );
elev_src.push_back( "DEM-30" );
bool done = false; bool done = false;
point_list result = geod_nodes; point_list result = geod_nodes;
int i, j; int i, j;
@ -205,25 +212,21 @@ static point_list calc_elevations( const string& root,
SGBucket b( result[i].x(), result[i].y() ); SGBucket b( result[i].x(), result[i].y() );
string base = b.gen_base_path(); string base = b.gen_base_path();
// try 3 arcsec arrays first // try the various elevation sources
string array_path = root + "/DEM-3/" + base bool found_file = false;
+ "/" + b.gen_index_str() + ".arr"; unsigned int j = 0;
SG_LOG(SG_GENERAL, SG_DEBUG, "array_path = " << array_path); while ( !found_file && j < elev_src.size() ) {
string array_path = root + "/" + elev_src[j] + "/" + base
if ( ! array.open(array_path) ) { + "/" + b.gen_index_str() + ".arr";
SG_LOG(SG_GENERAL, SG_DEBUG, "ERROR: cannot open 3 arcsec file " if ( array.open(array_path) ) {
<< array_path); found_file = true;
SG_LOG(SG_GENERAL, SG_DEBUG, "trying 30 arcsec file"); SG_LOG(SG_GENERAL, SG_DEBUG, "array_path = " << array_path);
}
// try 30 arcsec array j++;
array_path = root + "/DEM-30/" + base }
+ "/" + b.gen_index_str() + ".arr";
SG_LOG(SG_GENERAL, SG_DEBUG, "array_path = " << array_path); // this will fill in a zero structure if no array data
if ( ! array.open(array_path) ) { // found/opened
SG_LOG(SG_GENERAL, SG_ALERT,
"ERROR: cannot open 30 arcsec file " << array_path);
}
}
array.parse( b ); array.parse( b );
// update all the non-updated elevations that are inside // update all the non-updated elevations that are inside