treee111/wahooMapsCreator

Show tunnels in the map

masc4ii opened this issue ยท 15 comments

Is your feature request related to a problem? Please describe.

See the maps around lake garda. All the tunnels are not shown. It is hard to see which road goes where.
1

Describe the solution you'd like

Show the tunnels...

Problems

The green forest area is not transparent and tunnels are rendered under the forest. That looks really bad.
2

Transparency

By accident I found out, that the Bolt2 and Roam2 devices can handle transparency. But only, if it is defined via SVG. So the solution for tunnels is to use a semi-transparent forest SVG. And now the map looks like this:
3

Pull request

As my personal theme is now reduced to Bolt2 and Roam2 (my friends and myself just have these two), I can't easily create a pull request - it is too different now. But you find my "tunnel solution" in these commits in my fork. If you find it useful, you could add it for all the other Wahoo devices in the main fork (if possible - I don't know and can't test for Bolt1 and Roam1).
de160ba
00bb392

The same could be achived when transforming tunnel layer from -1 to something higher... and I found your transform xml "tunnel-transform.xml". Could you please help me, how to use that (on non-windows)? And does this work too? Would maybe be a more elegant solution than changing from a color to a transparent svg.

I have only taken over the tunnel-transform xml and processing. I am aware that there is a difference in macOS and Windows processing of tunnels but hadn't time to dig deeper there.
If you provide X/Y coordinates I can generate maps for that tile with Windows and macOS and take screenshots or send the tiles to you.

If you could bring a little light into the tunnel-transform stuff that would be nice! ๐Ÿ‘

Python really is not my programming language and for me it is a mystery anything works... ๐Ÿ˜ƒ ...respect for all the code!
But little progress on my side:

  • when processing, I get merged.osm.pbf
  • if I understand right, I should tag transform this file
  • on cmd in macOS I fired: osmosis --rb merged.osm.pbf --tag-transform file=tunnel-transform.xml --wb file=transformed.osm.pbf (all with absolute pathes, "transformed" has same size now; and it works with osmosis - not osmium as the other calls!)
  • then I removed merged.osm.pbf, but renamed transformed.osm.pbf to merged...
  • I again processed - it seems your tool uses the files beeing found
  • there is no newer merged.osm.pbf after processing again
  • but I can't see any change for the tunnels

Did I missunderstand a point in the code?

Edit: sry, me beeing stupid: I also should load the new map into cruiser. So, I confirm this works!
How can I run this command from your code...? ๐Ÿ˜„

Your transform xml changes level to =2. This is a little much - any reason for this? This shows tunnels over all other ways. I think level=0 looks nice. Here the above example with transformed level tag and other colors for the way types:
Bildschirmfoto 2022-10-31 um 20 34 47

Crazy... no idea what I do, but it seems to work with your processing and a little change (additional call) now for macOS:
7f7f73a
(ignore my "python3" - on my system it is called with python3, whyever)

Please be careful! I updated to latest Oct31 build, since that it stopped showing maps at all! Same for a friend. I copied back my backups and deleted vtm-elemnt folder - no luck.

thanks for the warning, the update didn't arrived for me but I heared in the Telegram group that it screwed a lot of people.

Actually I am tinkering with your tunnel-inputs. Is it right,

  • that the tunnels are in the map already (also on macOS)
  • but not visible because of the level?
  • and your code-change will change the level?

I'm testing with the BOLT version of vtm-elemnt.xml (from this repo) in cruiser and can't see a difference here but if the above written is right, that's because of the theme
grafik

There is a Telegram group for this? Do you have a link for that please, even if off-topic here? The one from your Readme page?

The tunnels are in the map, if you create the tiles with your application. In vtm-elemnt.xml the code is missing to show it. I added many lines here (see my fork). Now, the tunnels will be drawn below forests. After changing the level to 0, the tunnels are shown correctly.
Note: my vtm-elemnt is very different now to yours, because Roam2 had some problems with the default theme (mixed all devices). I killed all but Bolt2 and now it works for Roam2 too, perfectly.

There is a Telegram group for this? Do you have a link for that please, even if off-topic here? The one from your Readme page?

yes, the one from the README, very busy in the last days :-)
feel free to join: https://t.me/joinchat/TaMhjouxlsAzNWZk

The tunnels are in the map, if you create the tiles with your application. In vtm-elemnt.xml the code is missing to show it. I added many lines here (see my fork). Now, the tunnels will be drawn below forests. After changing the level to 0, the tunnels are shown correctly. Note: my vtm-elemnt is very different now to yours, because Roam2 had some problems with the default theme (mixed all devices). I killed all but Bolt2 and now it works for Roam2 too, perfectly.

Ok thanks for confiming, then my thoughts were allright. I also had a look at your fork!
I'll look out for tunneling later, I want to release v3.0.0 in the next few days and focus on that.

Cool that you changed a lot and also personalized the theme to suit you. Most likely the themes is what people do personalize.
My aim with this repo is to have a "well going" and good tested set of tooling and themes where others can fork from.

Bildschirmfoto 2022-11-01 um 22 24 25

That is the latest revision until my white screen problem, in cruiser. It was working like this also in my Bolt.

Joined the group! I hope there is a solution soon.

Hi @masc4ii,
I tinkered around and now came up with a clean and identical way of doing the merging stuff incl. tunnels in Windows and macOS with a19add7:

# Windows
if platform.system() == "Windows":
cmd = [self.osmosis_win_file_path]
# Non-Windows
else:
cmd = ['osmosis']
loop = 0
# 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:
cmd.append('--rbf')
cmd.append(os.path.join(
out_tile_dir, f'split-{country}.osm.pbf'))
cmd.append('workers=' + self.workers)
if loop > 0:
cmd.append('--merge')
cmd.append('--rbf')
cmd.append(os.path.join(
out_tile_dir, f'split-{country}-names.osm.pbf'))
cmd.append('workers=' + self.workers)
cmd.append('--merge')
loop += 1
for land in land_files:
cmd.extend(
['--rx', 'file='+land, '--s', '--m'])
cmd.extend(
['--rx', 'file='+os.path.join(out_tile_dir, 'sea.osm'), '--s', '--m'])
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"]}')
tile_count += 1

Could you please check if this works also with your local changes / theme?
It is branch tunnels-macOS-2
Thanks!

@treee111 : thank you! It works over here. Your code is better than my try. ๐Ÿ‘ You could change the level value to 0 in the tunnel xml. When using 2, the tunnels are rendered over all other objects - maybe not necessary.

thanks for your feedback @masc4ii and for bringing this up in general! We are getting there ;-)
Implemented the level-change as well. Gonna merge this in the next days, this issue will be closed then automatically.

Great! Thank you!

One more thing: I tried again on a fresh macOS.
-->

osmium-tool is not installed. 
Please refer to the Quickstart Guide of wahooMapsCreator for instructions:
- https://github.com/treee111/wahooMapsCreator/blob/develop/docs/QUICKSTART_ANACONDA.md                     
or create an issue:
- https://github.com/treee111/wahooMapsCreator/issues

osmium is not needed anymore, so this could be deleted.
Edit: sorry... I see it is still needed. But is it possible to move all commands over to osmosis instead of osmium?

you are right, there are still three usages of osmium. Btw. nice, that the check for needed packages worked as intended ๐Ÿ’ฏ

I had a brief look. It seems to be not super easy to move the 1st and 2nd usage over to osmosis.
Windows uses osmfilter (also available via homebrew) and osmconvert (not easy installable).
As usages of these two tools would not bring a benefit and would cause some work, I'll leave them two usages as they are.

I moved the 3rd usage over to osmosis, was easy ;-)

Thanks for giving a hint on that!