Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions wahoomc/osm_maps_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def filter_tags_from_country_osm_pbf_files(self): # pylint: disable=too-many-st
run_subprocess_and_log_output(
cmd, f'! Error in OSMFilter with country: {key}')

val['filtered_file'] = out_file_o5m_filtered_win
val['filtered_file_names'] = out_file_o5m_filtered_names_win
val['filtered_file'] = out_file_o5m_filtered_win.replace("/", "\\")
val['filtered_file_names'] = out_file_o5m_filtered_names_win.replace("/", "\\")

# Non-Windows
else:
Expand Down Expand Up @@ -374,7 +374,7 @@ def split_filtered_country_files_to_tiles(self):
for tile in self.o_osm_data.tiles:

for country, val in self.o_osm_data.border_countries.items():
if country not in tile['countries']:
if country not in tile['countries'] and country.replace("/","_") not in tile['countries']:
continue
self.log_tile_info(tile["x"], tile["y"], tile_count, country)
timings_tile = Timings()
Expand All @@ -393,7 +393,7 @@ def split_filtered_country_files_to_tiles(self):
cmd.extend(
['--complete-ways', '--complete-multipolygons', '--complete-boundaries'])
cmd.append(val['filtered_file'])
cmd.append('-o='+out_file)
cmd.append('-o='+out_file.replace("/","_"))

run_subprocess_and_log_output(
cmd, f'! Error in osmconvert with country: {country}. Win/out_file')
Expand All @@ -405,10 +405,10 @@ def split_filtered_country_files_to_tiles(self):
cmd.extend(
['--complete-ways', '--complete-multipolygons', '--complete-boundaries'])
cmd.append(val['filtered_file_names'])
cmd.append('-o='+out_file_names)
cmd.append('-o='+out_file_names.replace("/","_"))

run_subprocess_and_log_output(
cmd, '! Error in osmconvert with country: {country}. Win/out_file_names')
cmd, f'! Error in osmconvert with country: {country}. Win/out_file_names')

# Non-Windows
else:
Expand All @@ -417,22 +417,22 @@ def split_filtered_country_files_to_tiles(self):
['-b', f'{tile["left"]},{tile["bottom"]},{tile["right"]},{tile["top"]}'])
cmd.append(val['filtered_file'])
cmd.extend(['-s', 'smart'])
cmd.extend(['-o', out_file])
cmd.extend(['-o', out_file.replace("-us/","-us_")])
cmd.extend(['--overwrite'])

run_subprocess_and_log_output(
cmd, '! Error in Osmium with country: {country}. macOS/out_file')
cmd, f'! Error in Osmium with country: {country}. macOS/out_file')

cmd = ['osmium', 'extract']
cmd.extend(
['-b', f'{tile["left"]},{tile["bottom"]},{tile["right"]},{tile["top"]}'])
cmd.append(val['filtered_file_names'])
cmd.extend(['-s', 'smart'])
cmd.extend(['-o', out_file_names])
cmd.extend(['-o', out_file_names.replace("-us/","-us_")])
cmd.extend(['--overwrite'])

run_subprocess_and_log_output(
cmd, '! Error in Osmium with country: {country}. macOS/out_file_names')
cmd, f'! Error in Osmium with country: {country}. macOS/out_file_names')

self.log_tile_debug(tile["x"], tile["y"], tile_count, f'{country} {timings_tile.stop_and_return()}')

Expand Down Expand Up @@ -478,7 +478,7 @@ def merge_splitted_tiles_with_land_and_sea(self, process_border_countries, conto
# loop through all countries of tile, if border-countries should be processed.
# if border-countries should not be processed, only process the "entered" country
for country in tile['countries']:
if process_border_countries or country in self.o_osm_data.border_countries:
if process_border_countries or country in self.o_osm_data.border_countries or country.replace("_", "/") in self.o_osm_data.border_countries:
cmd.append('--rbf')
cmd.append(os.path.join(
out_tile_dir, f'split-{country}.osm.pbf'))
Expand Down