treee111 / wahoomapscreator Goto Github PK
View Code? Open in Web Editor NEWCreate maps for Wahoo device based on latest OSM maps
Create maps for Wahoo device based on latest OSM maps
New users need assistance.
Use https://download.geofabrik.de/index-v1.json for map creation instead of the wahoo json files in folder common_resources\json
The relevant tiles are calculated here:
wahooMapsCreator/common_resources/file_directory_functions.py
Lines 62 to 70 in 6490e6a
A clear and concise description of the problem, e.g. "I'm always frustrated when {...}"
A clear and concise description of what you want to happen.
A clear and concise description of any alternative solutions or features you've considered.
Add any other context or screenshots about the feature request here.
Invoke-WebRequest -URI 'https://github.com/treee111/wahooMapsCreator/releases/download/v2.0.0/wahooMapsCreator-v2.0.0-Windows.zip' -OutFile "$DownloadFolder\wahooMapsCreator-current.zip"
$WahooMapsCreatorHome="$DownloadFolder\wahooMapsCreator-current"
New-Item -Type directory -Force -Path $WahooMapsCreatorHome
Expand-Archive -Path "$DownloadFolder\wahooMapsCreator-current.zip" -DestinationPath $WahooMapsCreatorHome
$GdalEnvironment="C:\Program Files\Anaconda3\envs\gdal-user"
$DownloadFolder="$HOME\Desktop\wahooMapsCreator"
$WahooMapsCreatorHome="$DownloadFolder\wahooMapsCreator-current"
cd $WahooMapsCreatorHome
Remove-Item -Recurse -Force $GdalEnvironment
powershell -ExecutionPolicy ByPass -NoExit -Command "& 'C:\Program Files\Anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\Program Files\Anaconda3'"
conda env create -f .\conda_env\gdal-user.yml
$DownloadFolder="$HOME\Desktop\wahooMapsCreator"
$WahooMapsCreatorHome="$DownloadFolder\wahooMapsCreator-current"
cd $WahooMapsCreatorHome
conda activate gdal-user
python -m wahoomc cli -co malta -fp -fd -tag tag-wahoo.xml
Output:
INFO:--------------------------------------------------------------------------------
INFO:# Input country: malta.
INFO:--------------------------------------------------------------------------------
INFO:# Determine involved/border countries
INFO:+ Involved country: malta
INFO:--------------------------------------------------------------------------------
INFO:# check C:\Users\gercri\wahooMapsCreatorData\_download\land-polygons-split-4326\land_polygons.shp file
INFO:+ Deleting old C:\Users\gercri\wahooMapsCreatorData\_download\land-polygons-split-4326\land_polygons.shp file
INFO:+ C:\Users\gercri\wahooMapsCreatorData\_download\land-polygons-split-4326\land_polygons.shp file needs to be downloaded
INFO:# Need to download land polygons file
INFO:--------------------------------------------------------------------------------
INFO:+ Downloading land_polygons.shp file
INFO:+ Downloaded: C:\Users\gercri\wahooMapsCreatorData\_download\land-polygons-split-4326\land_polygons.shp
INFO:+ check land_polygons.shp file: OK
INFO:--------------------------------------------------------------------------------
INFO:# check countries .osm.pbf files
INFO:+ Checking for old maps and remove them
INFO:+ mapfile for malta: deleted. Input: malta.
INFO:--------------------------------------------------------------------------------
INFO:+ Downloading malta-latest.osm.pbf file
INFO:+ Downloaded: C:\Users\gercri\wahooMapsCreatorData\_download\maps\malta-latest.osm.pbf
INFO:+ Check countries .osm.pbf files: OK
INFO:--------------------------------------------------------------------------------
INFO:# Filter tags from country osm.pbf files
INFO:! cmd.append is ['C:\\Users\\gercri\\Desktop\\wahooMapsCreator\\wahooMapsCreator-current\\wahoomc\\tooling_win\\osmconvert64-0.8.8p', '-v', '--hash-memory=2500', '--complete-ways', '--complete-multipolygons', '--complete-boundaries', '--drop-author', '--drop-version', 'C:\\Users\\gercri\\wahooMapsCreatorData\\_download\\maps\\malta-latest.osm.pbf', '-o=C:\\Users\\gercri\\wahooMapsCreatorData\\_tiles\\outFile-malta.o5m']:
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\envs\gdal-user\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Program Files\Anaconda3\envs\gdal-user\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\gercri\Desktop\wahooMapsCreator\wahooMapsCreator-current\wahoomc\__main__.py", line 7, in <module>
main.run()
File "C:\Users\gercri\Desktop\wahooMapsCreator\wahooMapsCreator-current\wahoomc\main.py", line 47, in run
o_osm_maps.filter_tags_from_country_osm_pbf_files()
File "C:\Users\gercri\Desktop\wahooMapsCreator\wahooMapsCreator-current\wahoomc\osm_maps_functions.py", line 269, in filter_tags_from_country_osm_pbf_files
cmd, '! Error in OSMConvert with country: {key}')
File "C:\Users\gercri\Desktop\wahooMapsCreator\wahooMapsCreator-current\wahoomc\osm_maps_functions.py", line 79, in run_subprocess_and_log_output
with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) as process:
File "C:\Program Files\Anaconda3\envs\gdal-user\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\Program Files\Anaconda3\envs\gdal-user\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
tooling_win
must reside inside wahoomc
$DownloadFolder="$HOME\Desktop\wahooMapsCreator"
$WahooMapsCreatorHome="$DownloadFolder\wahooMapsCreator-current"
Move-Item $WahooMapsCreatorHome/tooling_win $WahooMapsCreatorHome/wahoomc/tooling_win
python3 wahoo_map_creator.py
Select 'asia', then....
Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/__init__.py", line 1883, in __call__ return self.func(*args) File "/Users/edwardwang/Documents/Code/wahooMapsCreator/common_resources/input.py", line 212, in callback_continent self.cb_country["values"] = ast.literal_eval('constants.' + continent.replace("-", "")) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ast.py", line 99, in literal_eval return _convert(node_or_string) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ast.py", line 98, in _convert return _convert_signed_num(node) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ast.py", line 75, in _convert_signed_num return _convert_num(node) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ast.py", line 66, in _convert_num _raise_malformed_node(node) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ast.py", line 63, in _raise_malformed_node raise ValueError(f'malformed node or string: {node!r}') ValueError: malformed node or string: <_ast.Attribute object at 0x7fb6b826fa60>
And I found another thing that 'Hong Kong' and 'Macao' are as same as China's map data, the tool downloaded 3 exactly same size file with diff filenames.
from: #10
use github-changelog-generator, git-chglog or similar to create the CHANGELOG.md instad of manually adding changes/features etc.
While testing different releases or upgrading the release, it is not convenient if one has to create a new Anaconda environment for each new release to use
Move conda environment from the root of wahooMapsCreator to the standard place for Anaconda environments to use it throughout different releases
A clear and concise description of any alternative solutions or features you've considered.
Add any other context or screenshots about the feature request here.
adjust the release-plugin to only build needed artifacts and not the whole repo
this issue is about discussing the two sets of constants here:
wahooMapsCreator/common_python/constants.py
Lines 203 to 226 in df80946
Can you (or anybody else) remember why we need two distinct sets resulting in two filtered files which are then merged with land and sea on the tile processing/generation?
Was it because of CLI argument length limitations on some platform?
Originally posted by @mweirauch in #108 (comment)
I looked it up.
We introduced the _NAMES constants and corresponding osmium / osmfilter processing in #46.
There are some sentenced about filtering out names of highways etc. with these additions.
I think lately there was a discussion about the need of these two sets in Telegram with no real outcome. In my opinion there might not be a technical need for two sets.
I'll try if my unittests check if there is a knowingly error. If yes, I could refactor that part in another PR.
Originally posted by @treee111 in #108 (comment)
Ah, thanks. I think I have not fully understood the filtering behaviour of the tools entirely.
At least on the non-Windows side this has no effect as the second osmium tags-filter
operation does not explicitely list a name=
filter expression like the second osmfilter
operation does on the Windows side.
But adding it, the filtered germany map for names blows up from 263MB to 1109MB.
No matter what, names are present when checking with osmium tags-count
or a custom vmt-elemnt.xml
theme displaying highway names. So I dunno if the two tag-sets are really needed.
Perhaps we can take this discussion to a new issue later on.
Originally posted by @mweirauch in #108 (comment)
Just as a heads up ... I just did a little testing. Using osmfilter to only keep tag historic
, making sure it's rendered by osmiums mapwriter plugin and the name tag of the historic
node I am looking at is displayed just fine. So I dunno if this is just osmfilter
magic with that special name handling, on the osmium side one wouldn't need two sets of tags. (I might still be completely missing something here.)
Originally posted by @mweirauch in #108 (comment)
while testing different releases or upgrading the release, the downloaded files either need to be copied from one release folder to the other or newly downloaded.
common_download
folder onto the same level as the root-repo folder or downloaded Release .zip isoutput
folder also to the same level as the root-repo
Add any other context or screenshots about the feature request here.
There are a lot of long os.path.join
statements to build paths throughout the repo.
These should be shortened to make the coding more readable.
do not build huge os.path.join
statements but use that:
and build the path from the location of the current file onwards if possible:
wahooMapsCreator/tests/test_generated_files.py
Lines 38 to 39 in 28787b3
reset filter_tags_from_country_osm_pbf_files
for macOS to version before merging #46
make filter_tags_from_country_osm_pbf_files
equal for processing in Windows and macOS:
Windows
correct constants for <> Windows to be correctly interpreted
wahooMapsCreator/common_python/constants.py
Lines 192 to 209 in 080262e
The CHANGELOG groups should be in the following order:
The order of CHANGELOG groups is as follows:
unknown
nothing
{...}
The pass (see further down) should be replaced by a check to see if command line parameters were supplied else it errors out later on (wsl does not have a graphical interface (yet))
running "python3 wahoo_map_creator.py" using Linux WSL under Windows
Linux WSL under Windows
nothing
get it to run in Windows using WSL:
try:
tk.Tk.__init__(self, *args, **kwargs)
# self.geometry("420x360")
self.title("Wahoo map creator")
self.configure(bg="white")
self.option_add("*Font", "Calibri 16")
container = tk.Frame(self)
container.pack(side = tk.TOP, fill = tk.BOTH, expand = True)
self.first = ComboboxesEntryField(container, self.o_input_data.max_days_old)
self.first.pack(side = tk.TOP, fill = tk.X)
self.third = Checkbuttons(container, self.o_input_data, controller = self)
self.third.pack(side = tk.TOP, fill = tk.X)
self.four = Buttons(container, controller = self)
self.four.pack(side = tk.TOP, fill = tk.X)
except:
pass
Existing GUI functionality to be used:
wahooMapsCreator/tooling_windows/wahoo-map-creator-windows-gui.py
Lines 15 to 18 in eff45d1
wahooMapsCreator/tooling_windows/wahoo-map-creator-windows-gui.py
Lines 55 to 139 in eff45d1
A clear and concise description of any alternative solutions or features you've considered.
Add any other context or screenshots about the feature request here.
{That the tiles are sorted}
{Error thrown in GUI
ERROR:Error in Osmosis with sorting land* osm files of tile: 129,94 }
nothing
{...}
A clear and concise description of the problem, e.g. "I'm always frustrated when {...}"
A clear and concise description of what you want to happen.
A clear and concise description of any alternative solutions or features you've considered.
Add any other context or screenshots about the feature request here.
Map should be converted for Wahoo Device
Converting fails
conda env create --prefix ./envs -f ./conda_env/enduser.yml
conda activate D:\wahooMapsCreator\envs
python wahoo_map_creator.py
Windows 10, Anaconda, wahooMapsCreator v.1.0.0
python wahoo_map_creator.py
+ Input country or json file: germany.
# Read json file
+ Use json file D:\wahooMapsCreator\common_resources\json\europe\germany.json with 57 tiles
# Read json file: OK
# check D:\wahooMapsCreator\common_download\land-polygons-split-4326\land_polygons.shp file
# D:\wahooMapsCreator\common_download\land-polygons-split-4326\land_polygons.shp file needs to be downloaded
# Downloading land_polygons.shp file
+ Downloaded: D:\wahooMapsCreator\common_download\land-polygons-split-4326\land_polygons.shp
# check land_polygons.shp file: OK
# check countries .osm.pbf files
+ Checking for old maps and remove them
+ Trying to download missing map of germany.
# Downloading germany-latest.osm.pbf file
+ Downloaded: D:\wahooMapsCreator\common_download\maps\germany-latest.osm.pbf
# Check countries .osm.pbf files: OK
# Filter tags from country osm.pbf files
+ Converting map of germany to o5m format
Traceback (most recent call last):
File "wahoo_map_creator.py", line 41, in <module>
oOSMmaps.filter_tags_from_country_osm_pbf_files()
File "D:\wahooMapsCreator\common_python\osm_maps_functions.py", line 143, in filter_tags_from_country_osm_pbf_files
result = subprocess.run(cmd, check=True)
File "D:\wahooMapsCreator\envs\lib\subprocess.py", line 512, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['D:\\wahooMapsCreator\\tooling_windows\\osmconvert', '-v', '--hash-memory=2500', '--complete-ways', '--complete-multipolygons', '--complete-boundaries', '--drop-author', '--drop-version', 'D:\\wahooMapsCreator\\common_download\\maps\\germany-latest.osm.pbf', '-o=D:\\wahooMapsCreator\\output\\outFile-germany.o5m']' returned non-zero exit status 3221225781.
A clear and concise description of any alternative solutions or features you've considered.
Add any other context or screenshots about the feature request here.
However I found I actually don't need all 'border countries', if there is a parameter to ignore them.
from: #10
possibilities:
For many users, the process of copying the files to device might be difficult.
There are some possibilities out there:
python -m wahoomc.copy
function could do the jobsee description in the beginning
Add any other context or screenshots about the feature request here.
{...}
{...}
unknown
nothing
{...}
The following page:
https://github.com/treee111/wahooMapsCreator/blob/develop/docs/QUICKSTART_MACOS.md
mentions "Install Osmfilter" twice as headers. The second one should be osmium-tool.
Additionally, it says to apt install osmctools
but apt
is not available on MacOS and that package is not available via brew
.
A clear and concise description of the problem, e.g. "I'm always frustrated when {...}"
A clear and concise description of what you want to happen.
A clear and concise description of any alternative solutions or features you've considered.
Add any other context or screenshots about the feature request here.
Identical paths for all OS
the zip files the max/linux/wsl creates contain full paths. For me that means that the tiles are in \mnt\c\wahoomapscreator\output\netherlands\ the windows version has just the folder netherlands
unknown
nothing
All of the arguments which can be used via CLI should also be usable via GUI.
Add any other context or screenshots about the feature request here.
Hi,
according to the documentation, map for example austria should be created with this command:
python wahoo_map_creator.py austria
Unfortunately, on a fresh installed Ubuntu (Ubuntu 21.10) buil fails with following error message:
python wahoo_map_creator.py austria
+ Input country or json file: austria.
# Read json file
+ Use json file /home/bka/Downloads/common_resources/json/europe/austria.json with 19 tiles
# Read json file: OK
# check land_polygons.shp file
# check land_polygons.shp file: OK
# check countries .osm.pbf files
+ Checking for old maps and remove them
+ mapfile for austria: up-to-date. Input: austria.
# Check countries .osm.pbf files: OK
# Filter tags from country osm.pbf files
+ Create filtered country file for austria
Traceback (most recent call last):
File "wahoo_map_creator.py", line 41, in <module>
oOSMmaps.filter_tags_from_country_osm_pbf_files()
File "/home/bka/Downloads/common_python/osm_maps_functions.py", line 197, in filter_tags_from_country_osm_pbf_files
result = subprocess.run(cmd, check=True)
File "/home/bka/Downloads/envs/lib/python3.7/subprocess.py", line 488, in run
with Popen(*popenargs, **kwargs) as process:
File "/home/bka/Downloads/envs/lib/python3.7/subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "/home/bka/Downloads/envs/lib/python3.7/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'osmium': 'osmium'
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.10
Release: 21.10
Codename: impish
conda -V
conda 4.10.3
python3 -V
Python 3.7.11
wahooMapsCreator/docs/QUICKSTART_ANACONDA.md
Lines 55 to 59 in 5e86dbf
brew
parts can be established via cmd... calls
python -m wahoomc.init
functionA clear and concise description of any alternative solutions or features you've considered.
Add any other context or screenshots about the feature request here.
` # ToDo: comment
if len(map_files) == 1 and os.path.isfile(map_files[0]):
file_creation_timestamp = os.path.getctime(map_files[0])
if file_creation_timestamp < to_old_timestamp or self.force_download == 1:
print(f'+ mapfile for {country}: deleted')
os.remove(map_files[0])
need_to_download = True
else:
border_countries[country] = {'map_file':map_files[0]}
print(f'+ mapfile for {country}: up-to-date')
if len(border_countries[country]) != 1 or not os.path.isfile(border_countries[country]['map_file']):
# if there exists no file or it is no file --> download
need_to_download = True`
I need to download China map with many border countries, so len(border_countries[country]) != 1 will always be true and it will always download all map files over times.
processing of mexico is not possible.
maps should be created for mexico.
python wahoo_maps_creator.py gui
--> select north-america
and mexico
python wahoo_map_creator.py mexico
Windows
nothing
osmconvert.exe should be usable without changes in the OS of Windows
wahooMapsCreator/common_python/osm_maps_functions.py
Lines 135 to 146 in 5e86dbf
python wahoo_map_creator.py malta
Windows
nothing
after performing the steps mentioned in the video https://www.youtube.com/watch?v=P-97qrYdqNA, still this error occurs:
This tool should run with the newest version of osmium-tool v1.13.2
With brew under macOS it is a little hassle to insall older formulae versions. E.g. v1.13.1 of osmium-tool.
when osmium-tool is installed in version 1.13.2 on macOS (and maybe Windows as well) the following error happens:
Objects in input file '/Users/benjamin/VSCode/wahooMapsCreator/output/138/100/land1.osm' out of order (must be nodes, then ways, then relations).
The cause is this new feature of v1.13.2:
- The `osmium merge` command now checks that the input files are ordered
in version https://github.com/osmcode/osmium-tool/releases/tag/v1.13.2
which seams to be made via commit osmcode/osmium-tool@740a565
Somehow our generated land1.osm
file seams not like osmium-tool needs it.
The file land1.osm
is generated here:
wahooMapsCreator/common_python/osm_maps_functions.py
Lines 250 to 263 in ed5b7cc
The error occurs in line 464, the command is built in the lines above
wahooMapsCreator/common_python/osm_maps_functions.py
Lines 445 to 464 in ed5b7cc
python3 wahoo_map_creator.py malta
macOS Catalina
osmium-tool v1.13.2
when osmium-tool is installed in version 1.13.2 on macOS (and maybe Windows as well) the following error happens:
Objects in input file '/Users/benjamin/VSCode/wahooMapsCreator/output/138/100/land1.osm' out of order (must be nodes, then ways, then relations).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.