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

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

Merged
merged 13 commits into from
Oct 3, 2022

Conversation

treee111
Copy link
Owner

@treee111 treee111 commented Sep 26, 2022

This PR…

  • Enhances function filter_tags_from_country_osm_pbf_files to speed up processing when playing with filtering tags / tag-mapping / tag-transform

Considerations and implementations

Coding that can be influeced by user-input:

  • Filtering unwanted map objects out of maps
  • Splitting filtered country files to tiles
  • Merging splitted tiles with land and sea
  • Creating map tiles - apply tag-wahoo xml

Coding that can not be influeced by user-input:

  • Converting map to o5m format (Windows only)

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 treee111 mentioned this pull request Sep 26, 2022
4 tasks
@treee111 treee111 changed the title [FEAT] Enhance filter_tags_from_country_osm_pbf_files to speed up processing when playing with filtering tags / tag-mapping / tag-transform [FEAT] Speeding up processing when playing with filtering tags / tag-mapping / tag-transform Sep 26, 2022
@treee111 treee111 added this to the v2.1.0 milestone Sep 26, 2022
@treee111 treee111 added the enhancement New feature or request label Sep 26, 2022
@treee111 treee111 changed the title [FEAT] Speeding up processing when playing with filtering tags / tag-mapping / tag-transform [FEAT] Speed up processing when playing with filtering tags / tag-mapping / tag-transform Sep 26, 2022
@treee111 treee111 force-pushed the update-osm-maps-functions branch from cc6c0b9 to e25a78a Compare September 28, 2022 19:57
@treee111
Copy link
Owner Author

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
Copy link
Contributor

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
Copy link
Owner Author

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
Copy link
Contributor

Perfect. That's it!

treee111 added a commit that referenced this pull request Sep 29, 2022
@treee111 treee111 force-pushed the update-osm-maps-functions branch from 172c5cf to 19e9e5b Compare September 29, 2022 19:17
@treee111 treee111 force-pushed the update-osm-maps-functions branch from 3edcbe7 to 57affb6 Compare September 29, 2022 21:32
@treee111 treee111 force-pushed the update-osm-maps-functions branch from bb8d40e to 1ec886c Compare September 29, 2022 21:34
treee111 and others added 3 commits September 30, 2022 08:14
…osm_maps_functions.py) (#152)

* import file_directory functions one by one

- and not by importing the whole file "as" fd_fct

* create OsmData object and insert into class OsmMaps

* move check for -co and -xy to input.py

* shuffle a lot

* go throught calc_border_countries also when no border countries are wanted

* break OsmData in small pieces

* refactor border country calc + fix unittests

* force_processing refactoring, all checks in OsmData now!

- move to function process_input_of_the_tool
- move corresponding stuff from check_and_download_files also
- additional needed changes - mainiy in downloader.py
- adjust tests & do nearly refactoring

* import needed functions + pylint findings

* refactor imports to "single import" and not the whole file

* fix pylint finding

* Bump to version v2.1.0a13
According to the documentation 
https://wiki.openstreetmap.org/wiki/Osmfilter#Keep_only_specific_Tags
tags have to be enclosed with >"<
Keep out_file_o5m if not force_processing to speed up build process when updating filtering tags / tag-mapping / tag-transform
@treee111 treee111 force-pushed the update-osm-maps-functions branch from 1ec886c to de0e856 Compare September 30, 2022 06:14
@treee111
Copy link
Owner Author

treee111 commented Oct 2, 2022

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
Copy link
Contributor

Everything looks perfect. Mapcreation runs smoothly under Windows.

@treee111
Copy link
Owner Author

treee111 commented Oct 3, 2022

Everything looks perfect. Mapcreation runs smoothly under Windows.

thanks!

@treee111 treee111 force-pushed the update-osm-maps-functions branch from 0cae7e4 to 7068867 Compare October 3, 2022 18:33
@treee111 treee111 changed the title [FEAT] Speed up processing when playing with filtering tags / tag-mapping / tag-transform [BREAKING] Newly process stuff that can be influenced by user-input without -fp Oct 3, 2022
@treee111 treee111 changed the title [BREAKING] Newly process stuff that can be influenced by user-input without -fp [BREAKING] Newly process stuff that can be influenced by user-input without -fp - speeds up playing with tags Oct 3, 2022
@treee111 treee111 changed the title [BREAKING] Newly process stuff that can be influenced by user-input without -fp - speeds up playing with tags [BREAKING] Process coding that can be influenced by user-input without -fp - speeds up playing with tags Oct 3, 2022
@treee111 treee111 merged commit 71161c1 into develop Oct 3, 2022
@treee111 treee111 deleted the update-osm-maps-functions branch October 3, 2022 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants