Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip unnecessary processing and other handling of zipping the output #40

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
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
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [Unreleased]
### Added
- Added a little error checking here and there.
- Added a check at the start to see if a country is to process is specified. Otherwise closing the GUI without selecting anything resulted in a runtime error.
### Changed
- In the filter stage, do not re-convert the result file(s) back to .osm.pbf format. This saves some time here but more importantly osmconvert is much faster in cutting tiles out of o5m
files then .osm.pbf files.
- Switched to using 'v12' tag (keep) filters. This only keeps the tags used by Wahoo's devices render themes.
Additionally, filter out all names tags except for those used, like city names. So highway names for example or filtered out.
- At the start of the splitting phase check for the existence of a merged .osm.pbf file. This prevents unnecessary splitting tiles out of for instance Europe when the tile is already
processed from a smaller, so faster, part like Germany.
- Create Wahoo tile present/version indicator files like 84.map.lzma.v12
- Changed how the resulting tiles.zip and maps.zip file is made. Now files are copied from the 'tilestore' to a country-name and country-name-maps folder. This folder is then passed
to the compressor instead of building an enormous command line with all file names specified. This would, for large countries like Russia, result in errors because the command line
was to long.
- Added advantage: Optionally you can choose to keep these folders so you can instantly copy the files to your device or check them in Cruiser.
- In the "are files older then x days" stage use the files modification date, not the creation time. On windows this seemed to occasionally see newly downloaded files as the ones they replaced.
- When checking for existing maps, check for a full match instead of doing a wildcard match. This prevents matching to multiple maps like australia and australia-oceania.
- Moved the keep_map_folder flag to the more appropriate input module.
[PR40](https://github.com/treee111/wahooMapsCreator/pull/40)

## [Unreleased]
### Added
- tag-wahoo-v12.xml which is a updated version of the current tag-wahoo-hidrive2.xml. Bus_guideways have been removed and the zoom-appear levels are copied from the original wahoo maps.
Expand Down
49 changes: 44 additions & 5 deletions common_python/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,47 @@
noregion_geofabrik = ['russia','asia']

# Tags to keep
filtered_tags = ['access', 'admin_level', 'aerialway', 'aeroway', 'barrier',
'boundary', 'bridge', 'highway', 'natural', 'oneway', 'place',
'railway', 'tracktype', 'tunnel', 'waterway']

FILTERED_TAGS_WIN = 'access= admin_level= aerialway= aeroway= barrier= boundary= bridge= highway= natural= oneway= place= railway= tracktype= tunnel= waterway='
#filtered_tags = ['access', 'admin_level', 'aerialway', 'aeroway', 'barrier',
# 'boundary', 'bridge', 'highway', 'natural', 'oneway', 'place',
# 'railway', 'tracktype', 'tunnel', 'waterway']
filtered_tags = 'access \
area=yes \
bicycle \
bridge \
foot=ft_yes, foot_designated \
highway=abandoned, bus_guideway, disused, bridleway, byway, construction, cycleway, footway, living_street, motorway, motorway_link, path, pedestrian, primary, primary_link, residential, road, secondary, secondary_link, service, steps, tertiary, tertiary_link, track, trunk, trunk_link, unclassified \
natural=coastline, nosea, sea, beach, land, scrub, water, wetland =wood \
leisure=park, nature_reserve \
railway=abandoned, bus_guideway, disused, funicular, light_rail, miniature, narrow_gauge, preserved, rail, subway, tram \
surface \
tracktype \
tunnel \
waterway=canal, drain, river, riverbank \
wood=deciduous'

filtered_tags_names = 'admin_level=2 \
area=yes \
mountain_pass \
natural \
place=city, hamlet, island, isolated_dwelling, islet, locality, suburb, town, village, country'

FILTERED_TAGS_WIN = 'access= \
area=yes \
bicycle= \
bridge= \
foot=ft_yes =foot_designated \
highway=abandoned =bus_guideway =disused =bridleway =byway =construction =cycleway =footway =living_street =motorway =motorway_link =path =pedestrian =primary =primary_link =residential =road =secondary =secondary_link =service =steps =tertiary =tertiary_link =track =trunk =trunk_link =unclassified \
natural=coastline =nosea =sea =beach =land =scrub =water =wetland =wood \
leisure=park =nature_reserve \
railway=abandoned =bus_guideway =disused =funicular =light_rail =miniature =narrow_gauge =preserved =rail =subway =tram \
surface= \
tracktype= \
tunnel= \
waterway=canal =drain =river =riverbank \
wood=deciduous'

FILTERED_TAGS_WIN_NAMES = 'admin_level=2 \
area=yes \
mountain_pass= \
natural= \
place=city =hamlet =island =isolated_dwelling =islet =locality =suburb =town =village =country'
8 changes: 4 additions & 4 deletions common_python/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def check_polygons_file(self):

# Check for expired land polygons file and delete it
try:
chg_time = os.path.getctime(fd_fct.LAND_POLYGONS_PATH)
chg_time = os.path.getmtime(fd_fct.LAND_POLYGONS_PATH)
if older_than_x_days(chg_time, self.max_days_old):
print('# Deleting old land polygons file')
os.remove(fd_fct.LAND_POLYGONS_PATH)
Expand Down Expand Up @@ -132,14 +132,14 @@ def check_osm_pbf_file(self):
transl_c = const_fct.translate_country_input_to_geofabrik(country)

# check for already existing .osm.pbf file
map_file_path = glob.glob(f'{fd_fct.MAPS_DIR}/{transl_c}*.osm.pbf')
map_file_path = glob.glob(f'{fd_fct.MAPS_DIR}/{transl_c}-latest.osm.pbf')
if len(map_file_path) != 1:
map_file_path = glob.glob(
f'{fd_fct.MAPS_DIR}/**/{transl_c}*.osm.pbf')
f'{fd_fct.MAPS_DIR}/**/{transl_c}-latest.osm.pbf')

# delete .osm.pbf file if out of date
if len(map_file_path) == 1 and os.path.isfile(map_file_path[0]):
chg_time = os.path.getctime(map_file_path[0])
chg_time = os.path.getmtime(map_file_path[0])
if older_than_x_days(chg_time, self.max_days_old) or self.force_download is True:
print(
f'+ mapfile for {transl_c}: deleted. Input: {country}.')
Expand Down
3 changes: 3 additions & 0 deletions common_python/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def __init__(self):
self.only_merge = False

self.tag_wahoo_xml = "tag-wahoo.xml"
# Keep (1) or delete (0) the country/region map folders after compression
#self.keep_map_folders = 0
self.keep_map_folders = 1

class Input(tk.Tk):
"""
Expand Down
Loading