treee111 / wahooMapsCreator

Create maps for Wahoo device based on latest OSM maps
GNU General Public License v3.0
259 stars 26 forks source link

[BREAKING] Process coding that can be influenced by user-input without `-fp` - speeds up playing with tags #150

Closed treee111 closed 2 years ago

treee111 commented 2 years ago

This PR…

Considerations and implementations

Coding that can be influeced by user-input:

Coding that can not be influeced by user-input:

How to test

checkout this branch or install version v2.1.0a14 via pip install wahoo_mc==2.1.0a14

  1. Run python -m wahoomc cli -co malta -tag tag-wahoo.xml -fp
  2. check size and content of generated maps
  3. python -m wahoomc cli -co malta -tag tag-wahoo-poi.xml
  4. check size and content of generated maps

The files from 2. and 4. should be different. This would show, that the both .xml files have done their job.

Pull Request Checklist

treee111 commented 2 years ago

Hi @zenziwerken, as announced I made a separate PR for the changes for potential speed gains. I tested it like written in the "How to test" section. The generated files had no differences, I needed a -fp on the second command to get the poi xml interpreted and other output. This is not what the achievement should be if I understood it correc.

Are the changes in this PR like you proposed? Is description and the "How to test" written by me the same as you thought with these changes?

Thanks!

zenziwerken commented 2 years ago

I did not make myself sufficiently clear. The result should be the same. It just skip converting the original pfb-file from OSM to o5m every time when playing with filtering tags / tag-mapping / tag-transform.

treee111 commented 2 years ago

I did not make myself sufficiently clear. The result should be the same. It just skip converting the original pfb-file from OSM to o5m every time when playing with filtering tags / tag-mapping / tag-transform.

This was also what I interpreted from your changes, but thought I was not having the real understanding.

I think I got now what would give a speed gain:

  1. skip the pfb-file to o5m file creation if the o5m file is there already why: because there is no user-influence possible
  2. do o5m file creation when -fp is given or o5m file does not exist
  3. do the filtering with constants every time why: because there is a possible user-influence
  4. apply the tag-wahoo .xml file during map creation every time why: because there is a possible user-influence

After that, -fp has kind of changes the character in these situations and we can further check if the -fp is still valid, can be deleted or can be combined with -fd

zenziwerken commented 2 years ago

Perfect. That's it!

treee111 commented 2 years ago

Hi @zenziwerken, so I am done now in my opinion. You can have a look at the changes in the "Files changed" tab. "Hide whitespaces" makes the diff not so hugh. Could you please test in your Windows environment if everything works as desired? I created v2.1.0a14 for easy test-install. Thanks! Greetings

zenziwerken commented 2 years ago

Everything looks perfect. Mapcreation runs smoothly under Windows.

treee111 commented 2 years ago

Everything looks perfect. Mapcreation runs smoothly under Windows.

thanks!