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

[FEAT] Refactor a lot to decouple and make maintenance easier (focus osm_maps_functions.py) #152

Merged
merged 12 commits into from
Sep 29, 2022

Conversation

treee111
Copy link
Owner

This PR…

  • breaks osm_maps_functions.py into two classes: one for the data and one for processing maps
  • refactors a lot of stuff around: calc_border_countries, input checks, proce_processing evaluation
  • refactors the imports to "single import" instead of importing the whole file

Considerations and implementations

A lot of lines change with this PR, the unittests rise from 45 to 47.
In the long run this is a useful refactoring which makes understanding easier.

How to test

  1. do everything you do with wahooMapsCreator

Pull Request Checklist

@treee111 treee111 changed the title [FEAT] Refactor osm_maps_functions.py and more to decouple and make maintenance easier [FEAT] Refactor a lot to decouple and make maintenance easier (focus osm_maps_functions.py) Sep 29, 2022
@treee111 treee111 merged commit 43511eb into develop Sep 29, 2022
@treee111 treee111 deleted the refactor-osm-maps-functions branch September 29, 2022 21:17
treee111 added a commit that referenced this pull request Sep 30, 2022
…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

* Revert "Bump to version v2.1.0a13"

This reverts commit 39d65b22689eea3f358d381ce05da2f641b5ebb6.
treee111 added a commit that referenced this pull request Sep 30, 2022
…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
treee111 added a commit that referenced this pull request Oct 3, 2022
…t `-fp` - speeds up playing with tags (#150)

* [FEAT] Refactor a lot to decouple and make maintenance easier (focus 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

* Update osm_maps_functions.py

According to the documentation 
https://wiki.openstreetmap.org/wiki/Osmfilter#Keep_only_specific_Tags
tags have to be enclosed with >"<

* Update osm_maps_functions.py

Keep out_file_o5m if not force_processing to speed up build process when updating filtering tags / tag-mapping / tag-transform

* finalization of @zenziwerken 's work

pylint finding, comment

* catch error if file does not exist but should be deleted

e.g. if processing -fp after switching from v2.0.2 to this version (Windows only)

* adjust constants processing based on discussion in PR

#150 (comment)

* adjust tag-wahoo.xml processing based on discussion in PR

#150 (comment)

* adjust splitting to tiles processing based on discussion in PR

#150 (comment)

* adjust merging with land and sea processing based on discussion in PR

#150 (comment)

* fix pylint finding

* harmonize comments

* Bump to version v2.1.0a14

* Revert to version v2.0.2

Co-authored-by: Daniel Groß <[email protected]>

BREAKING CHANGE:
Coding that can be influenced by user-input is now processed without giving `-fp` and coding that can not be influenced is only re-procecced when issuing `-fp`. That speeds up playing with tags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant