Skip to content

Commit

Permalink
[FIX] Search for existing elevation data based on requested type
Browse files Browse the repository at this point in the history
- differentiate between the two supported types srtm1 and view1
  • Loading branch information
treee111 committed Jul 10, 2023
1 parent b6fd62d commit b49330a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,22 @@
"--verbose"
],
"justMyCode": false
},
{
"name": "xy: Plauen - contour #145",
"type": "python",
"request": "launch",
"module": "wahoomc",
"console": "integratedTerminal",
"args": [
"cli",
"-xy",
"136/86",
"-fp",
"-c",
"-con"
// "-srtm1"
]
}
]
}
15 changes: 11 additions & 4 deletions wahoomc/osm_maps_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,17 +531,24 @@ def generate_elevation(self, use_srtm1):
for tile in self.o_osm_data.tiles:
out_file_elevation = os.path.join(
USER_OUTPUT_DIR, f'{tile["x"]}', f'{tile["y"]}', 'elevation')
# as the elevation file has a suffix, they need to be searched with glob.glob

# 1) as the elevation file has a suffix, they need to be searched with glob.glob
# example elevation filename: elevation_lon14.06_15.47lat35.46_36.60_view1,view3.osm
out_file_elevation_existing = glob.glob(os.path.join(
USER_OUTPUT_DIR, str(tile["x"]), str(tile["y"]), 'elevation*.osm'))

# use view1 as default source and srtm1 if wished by the user
# 2) use view1 as default source and srtm1 if wished by the user
# view1 offers better quality in general apart fro some places
# where srtm1 is the better choice
if use_srtm1:
# 1) search for srtm1 elevation files
out_file_elevation_existing = glob.glob(os.path.join(
USER_OUTPUT_DIR, str(tile["x"]), str(tile["y"]), 'elevation*srtm1*.osm'))
# 2) set source
elevation_source = '--source=srtm1,view1,view3,srtm3'
else:
# 1) search vor view1 elevation files
out_file_elevation_existing = glob.glob(os.path.join(
USER_OUTPUT_DIR, str(tile["x"]), str(tile["y"]), 'elevation*view1*.osm'))
# 2) set source
elevation_source = '--source=view1,view3,srtm3'

# check for already existing elevation .osm file (the ones matched via glob)
Expand Down

0 comments on commit b49330a

Please sign in to comment.