diff --git a/wahoomc/main.py b/wahoomc/main.py index dfa17b11..0f516111 100644 --- a/wahoomc/main.py +++ b/wahoomc/main.py @@ -92,12 +92,13 @@ def run(run_level): # Merge splitted tiles with land and sea o_osm_maps.merge_splitted_tiles_with_land_and_sea( - o_input_data.process_border_countries, o_input_data.contour) + o_input_data.process_border_countries, o_input_data.contour, o_input_data.verbose) # Creating .map files o_osm_maps.create_map_files(o_input_data.save_cruiser, o_input_data.tag_wahoo_xml, - o_input_data.hdd_mode) + o_input_data.hdd_mode, + o_input_data.verbose) # Zip .map.lzma files o_osm_maps.make_and_zip_files('.map.lzma', o_input_data.zip_folder) diff --git a/wahoomc/osm_maps_functions.py b/wahoomc/osm_maps_functions.py index 94128805..0131e7ba 100644 --- a/wahoomc/osm_maps_functions.py +++ b/wahoomc/osm_maps_functions.py @@ -440,7 +440,7 @@ def split_filtered_country_files_to_tiles(self): log.info('+ Split filtered country files to tiles: OK, %s', timings.stop_and_return()) - def merge_splitted_tiles_with_land_and_sea(self, process_border_countries, contour): # pylint: disable=too-many-locals + def merge_splitted_tiles_with_land_and_sea(self, process_border_countries, contour, verbose_debug): # pylint: disable=too-many-locals """ Merge splitted tiles with land elevation and sea - elevation data only if requested @@ -508,8 +508,14 @@ def merge_splitted_tiles_with_land_and_sea(self, process_border_countries, conto cmd.extend(['--tag-transform', 'file=' + os.path.join(RESOURCES_DIR, 'tunnel-transform.xml'), '--wb', out_file_merged, 'omitmetadata=true']) - run_subprocess_and_log_output( - cmd, f'! Error in Osmosis with tile: {tile["x"]},{tile["y"]}') + if platform.system() == "Windows" and verbose_debug: + result = subprocess.run(cmd, check=False) + if result.returncode != 0: + print(f'! Error in Osmosis with tile: {tile["x"]},{tile["y"]}') + sys.exit() + else: + run_subprocess_and_log_output( + cmd, f'! Error in Osmosis with tile: {tile["x"]},{tile["y"]}') self.log_tile_debug(tile["x"], tile["y"], tile_count, timings_tile.stop_and_return()) tile_count += 1 @@ -545,7 +551,7 @@ def sort_osm_files(self, tile): log.debug('+ Sorting land* osm files: OK') - def create_map_files(self, save_cruiser, tag_wahoo_xml, hdd_mode): + def create_map_files(self, save_cruiser, tag_wahoo_xml, hdd_mode, verbose_debug): """ Creating .map files """ @@ -595,8 +601,14 @@ def create_map_files(self, save_cruiser, tag_wahoo_xml, hdd_mode): 'The tag-wahoo xml file was not found: ˚%s˚. Does the file exist and is your input correct?', tag_wahoo_xml) sys.exit() - run_subprocess_and_log_output( - cmd, f'Error in creating map file via Osmosis with tile: {tile["x"]},{tile["y"]}. mapwriter plugin installed?') + if platform.system() == "Windows" and verbose_debug: + result = subprocess.run(cmd, check=False) + if result.returncode != 0: + print(f'Error in creating map file via Osmosis with tile: {tile["x"]},{tile["y"]}. mapwriter plugin installed?') + sys.exit() + else: + run_subprocess_and_log_output( + cmd, f'Error in creating map file via Osmosis with tile: {tile["x"]},{tile["y"]}. mapwriter plugin installed?') # Windows if platform.system() == "Windows":