Skip to content

Commit

Permalink
rename to mahoomc
Browse files Browse the repository at this point in the history
  • Loading branch information
treee111 committed May 7, 2022
1 parent 9e93adf commit 592221c
Show file tree
Hide file tree
Showing 420 changed files with 96 additions and 96 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ jobs:
matrix:
python-version: ["3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
pip install mock
pip install requests
- name: Analysing the code with pylint
run: |
pylint -j 0 ./wahoo_mc ./tests
continue-on-error: false
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
pip install mock
pip install requests
- name: Analysing the code with pylint
run: |
pylint -j 0 ./wahoomc ./tests
continue-on-error: false
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ osmconvert_tempfile.*
# mac/unix

#windows
/wahoo_mc/tooling_win/osmconvert_tempfile.*
/wahoomc/tooling_win/osmconvert_tempfile.*

# build artefacts
*.pyc
.eggs/
/wahoo_mc.egg-info/
/wahoomc.egg-info/
/dist/
/build/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ conda activate gdal-user
```
Run wahooMapsCreator via GUI
```
python -m wahoo_mc gui
python -m wahoomc gui
```
Or run wahooMapsCreator via CLI
```
python -m wahoo_mc cli -co malta
python -m wahoomc cli -co malta
```

A detailled description of the usage is documented [:computer: here](docs/USAGE.md#usage-of-wahoomapscreator)
Expand Down
2 changes: 1 addition & 1 deletion conda_env/gdal-user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ dependencies:
- gdal=3.4.*
- pip
- pip:
- wahoo-mc==2.0.0a3
- wahoomc==2.0.0a3
16 changes: 8 additions & 8 deletions copyFilesToDist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ cd ../..
cd dist/${FOLDER_NAME_MAC}

# create empty sub-folders
mkdir -p ./wahoo_mc
mkdir -p ./wahoo_mc/resources
mkdir -p ./wahoomc
mkdir -p ./wahoomc/resources
mkdir -p ./conda_env
mkdir -p ./tooling
mkdir -p ./docs

# copy files into dist-folder
cp -a ../../wahoo_mc/*.py ./wahoo_mc/
cp -a ../../wahoo_mc/resources/*.xml ./wahoo_mc/resources/
cp -a ../../wahoo_mc/resources/*.osm ../../wahoo_mc/resources/*.py ./wahoo_mc/resources/
cp -a ../../wahoo_mc/resources/json/ ./wahoo_mc/resources/json
cp -a ../../wahoo_mc/resources/tag_wahoo_adjusted/ ./wahoo_mc/resources/tag_wahoo_adjusted
cp -a ../../wahoo_mc/resources/tag_wahoo_initial/ ./wahoo_mc/resources/tag_wahoo_initial
cp -a ../../wahoomc/*.py ./wahoomc/
cp -a ../../wahoomc/resources/*.xml ./wahoomc/resources/
cp -a ../../wahoomc/resources/*.osm ../../wahoomc/resources/*.py ./wahoomc/resources/
cp -a ../../wahoomc/resources/json/ ./wahoomc/resources/json
cp -a ../../wahoomc/resources/tag_wahoo_adjusted/ ./wahoomc/resources/tag_wahoo_adjusted
cp -a ../../wahoomc/resources/tag_wahoo_initial/ ./wahoomc/resources/tag_wahoo_initial

cp -a ../../docs/*.md ./docs/
cp -a ../../CHANGELOG.md ../../README.md ./
Expand Down
22 changes: 11 additions & 11 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ In a next step you can run it for your own country.
## GUI (Graphical User Interface)

From the `root` folder of wahooMapsCreator, run:
- `python -m wahoo_mc gui`
- `python -m wahoomc gui`

Set your arguments as required via the window:

Expand All @@ -21,34 +21,34 @@ Set your arguments as required via the window:
## CLI (Command Line Interface)

From the `root` folder of wahooMapsCreator, run:
- `python -m wahoo_mc cli -co <country_name>`
- `python -m wahoomc cli -co <country_name>`

Examples:
- for Malta: `python -m wahoo_mc cli -co malta`
- for Ireland: `python -m wahoo_mc cli -co ireland`
- for Malta: `python -m wahoomc cli -co malta`
- for Ireland: `python -m wahoomc cli -co ireland`

## Advanced CLI-Usage
The script supports many arguments via command line.
For a list of all supported arguments, run:
- `python -m wahoo_mc cli -h`
- `python -m wahoomc cli -h`

### Main arguments
**Create maps for a country**
- `python -m wahoo_mc cli -co <country>`
- `python -m wahoomc cli -co <country>`

**Create maps for X/Y coordinates**

In particular for testing adjustments in configuration-files or coding it is helpful to create maps for only one tile or a handful of tiles!

To create maps for only one tile and not a whole country, one can use the X/Y coordinates of that tile. X/Y coordinates can be retrieved from this in zoom-level 8: [link](http://tools.geofabrik.de/map/#8/50.3079/8.8026&type=Geofabrik_Standard&grid=1).
- `python -m wahoo_mc cli -xy <xy_coordinate,xy_coordinate>`
- `python -m wahoomc cli -xy <xy_coordinate,xy_coordinate>`

### Examples
- for Malta, download new maps if existing maps are older than 100 days and process files even if files exist
- `python -m wahoo_mc cli -co malta -md 100 -fp`
- `python -m wahoomc cli -co malta -md 100 -fp`
- for Germany, download and process whole tiles which involves other countries than the given
- `python -m wahoo_mc cli -co germany -bc`
- `python -m wahoomc cli -co germany -bc`
- to create maps for only one tile
- `python -m wahoo_mc cli -xy 134/88`
- `python -m wahoomc cli -xy 134/88`
- for multiple tiles
- `python -m wahoo_mc cli -xy 134/88,133/88`
- `python -m wahoomc cli -xy 134/88,133/88`
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
name = wahoo-mc
name = wahoomc
version = 2.0.0a3
author = Benjamin Kreuscher
author_email = [email protected]
Expand All @@ -15,11 +15,11 @@ classifiers =
Operating System :: OS Independent

[options]
packages = wahoo_mc
packages = wahoomc
python_requires = >=3.7
install_requires =
requests==2.27.*
shapely==1.8.*

[options.package_data]
wahoo_mc = resources/*.*, resources/**/*.*, resources/*/*/*.*, resources/*/*/*/*.*
wahoomc = resources/*.*, resources/**/*.*, resources/*/*/*.*, resources/*/*/*/*.*
6 changes: 3 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_top_parser_help(self):
tests, if help of top parser can be called
"""

result = os.system("python -h wahoo_mc -h")
result = os.system("python -h wahoomc -h")

self.assertEqual(result, 0)

Expand All @@ -26,7 +26,7 @@ def test_cli_help(self):
tests, if CLI help can be called
"""

result = os.system("python -h wahoo_mc cli -h")
result = os.system("python -h wahoomc cli -h")

self.assertEqual(result, 0)

Expand All @@ -35,7 +35,7 @@ def test_gui_help(self):
tests, if GUI help can be called
"""

result = os.system("python -h wahoo_mc gui -h")
result = os.system("python -h wahoomc gui -h")

self.assertEqual(result, 0)

Expand Down
20 changes: 10 additions & 10 deletions tests/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from mock import patch


from wahoo_mc.constants_functions import translate_country_input_to_geofabrik
from wahoo_mc.constants_functions import translate_tags_to_keep
from wahoomc.constants_functions import translate_country_input_to_geofabrik
from wahoomc.constants_functions import translate_tags_to_keep


class TestTranslateCountries(unittest.TestCase):
Expand Down Expand Up @@ -85,7 +85,7 @@ class TestTranslateTags(unittest.TestCase):
tests for translating tags-constants between the universal format and OS-specific formats
"""

@patch('wahoo_mc.constants.TAGS_TO_KEEP_UNIVERSAL', tags_universal_simple)
@patch('wahoomc.constants.TAGS_TO_KEEP_UNIVERSAL', tags_universal_simple)
def test_translate_tags_to_keep_simple_macos(self):
"""
Test translating tags to keep from universal format to macOS
Expand All @@ -96,7 +96,7 @@ def test_translate_tags_to_keep_simple_macos(self):
transl_tags = translate_tags_to_keep()
self.assertEqual(tags, transl_tags)

@patch('wahoo_mc.constants.TAGS_TO_KEEP_UNIVERSAL', tags_universal_simple)
@patch('wahoomc.constants.TAGS_TO_KEEP_UNIVERSAL', tags_universal_simple)
def test_translate_tags_to_keep_simple_win(self):
"""
Test translating tags to keep from universal format to Windows
Expand All @@ -107,7 +107,7 @@ def test_translate_tags_to_keep_simple_win(self):
transl_tags = translate_tags_to_keep(sys_platform='Windows')
self.assertEqual(tags_win, transl_tags)

@patch('wahoo_mc.constants.TAGS_TO_KEEP_UNIVERSAL', tags_universal_adv)
@patch('wahoomc.constants.TAGS_TO_KEEP_UNIVERSAL', tags_universal_adv)
def test_translate_tags_to_keep_adv_macos(self):
"""
Test translating tags to keep from universal format to macOS
Expand All @@ -119,7 +119,7 @@ def test_translate_tags_to_keep_adv_macos(self):
transl_tags = translate_tags_to_keep()
self.assertEqual(tags, transl_tags)

@patch('wahoo_mc.constants.TAGS_TO_KEEP_UNIVERSAL', tags_universal_adv)
@patch('wahoomc.constants.TAGS_TO_KEEP_UNIVERSAL', tags_universal_adv)
def test_translate_tags_to_keep_adv_win(self):
"""
Test translating tags to keep from universal format to Windows
Expand All @@ -130,7 +130,7 @@ def test_translate_tags_to_keep_adv_win(self):
transl_tags = translate_tags_to_keep(sys_platform='Windows')
self.assertEqual(tags_win, transl_tags)

# @patch('wahoo_mc.constants.TAGS_TO_KEEP_UNIVERSAL', tags_universal_full)
# @patch('wahoomc.constants.TAGS_TO_KEEP_UNIVERSAL', tags_universal_full)
def test_translate_tags_to_keep_full_macos(self):
"""
Test translating tags to keep from universal format to macOS // all "tags to keep"
Expand All @@ -145,7 +145,7 @@ def test_translate_tags_to_keep_full_macos(self):
transl_tags = translate_tags_to_keep()
self.assertEqual(tags, transl_tags)

# @patch('wahoo_mc.constants.TAGS_TO_KEEP_UNIVERSAL', tags_universal_full)
# @patch('wahoomc.constants.TAGS_TO_KEEP_UNIVERSAL', tags_universal_full)
def test_translate_tags_to_keep_full_win(self):
"""
Test translating tags to keep from universal format to Windows // all "tags to keep"
Expand All @@ -156,7 +156,7 @@ def test_translate_tags_to_keep_full_win(self):
transl_tags = translate_tags_to_keep(sys_platform='Windows')
self.assertEqual(tags_win, transl_tags)

# @patch('wahoo_mc.constants.NAME_TAGS_TO_KEEP_UNIVERSAL', name_tags_universal_full)
# @patch('wahoomc.constants.NAME_TAGS_TO_KEEP_UNIVERSAL', name_tags_universal_full)
def test_translate_name_tags_to_keep_full_macos(self):
"""
Test translating name tags to keep from universal format to Windows // all "name tags to keep"
Expand All @@ -168,7 +168,7 @@ def test_translate_name_tags_to_keep_full_macos(self):
transl_tags = translate_tags_to_keep(name_tags=True)
self.assertEqual(names_tags, transl_tags)

# @patch('wahoo_mc.constants.NAME_TAGS_TO_KEEP_UNIVERSAL', name_tags_universal_full)
# @patch('wahoomc.constants.NAME_TAGS_TO_KEEP_UNIVERSAL', name_tags_universal_full)
def test_translate_name_tags_to_keep_full_win(self):
"""
Test translating name tags to keep from universal format to macOS // all "name tags to keep"
Expand Down
10 changes: 5 additions & 5 deletions tests/test_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
# import custom python packages
# sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from wahoo_mc.downloader import older_than_x_days
from wahoo_mc.downloader import download_file
from wahoo_mc.downloader import get_osm_pbf_filepath_url
from wahoo_mc.downloader import Downloader
from wahoo_mc import file_directory_functions as fd_fct
from wahoomc.downloader import older_than_x_days
from wahoomc.downloader import download_file
from wahoomc.downloader import get_osm_pbf_filepath_url
from wahoomc.downloader import Downloader
from wahoomc import file_directory_functions as fd_fct


class TestDownloader(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_generated_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


# import custom python packages
from wahoo_mc import file_directory_functions as fd_fct
from wahoomc import file_directory_functions as fd_fct

dirname_of_file = os.path.dirname(__file__)

Expand Down Expand Up @@ -209,7 +209,7 @@ def run_wahoomapscreator_cli(self, country, given_osm_pbf):
cli_command = "python3"

result = os.system(
f'{cli_command} -m wahoo_mc cli -co {country} -tag tag-wahoo.xml -fp -c -md 100')
f'{cli_command} -m wahoomc cli -co {country} -tag tag-wahoo.xml -fp -c -md 100')

# check if run was successful
self.assertEqual(result, 0)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_geofabrik.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import unittest

# import custom python packages
from wahoo_mc.geofabrik import Geofabrik
from wahoo_mc import file_directory_functions as fd_fct
from wahoo_mc import constants_functions as const_fct
from wahoo_mc.downloader import Downloader
from wahoomc.geofabrik import Geofabrik
from wahoomc import file_directory_functions as fd_fct
from wahoomc import constants_functions as const_fct
from wahoomc.downloader import Downloader


def calc_tiles_via_geofabrik_json(input_argument):
Expand Down
16 changes: 8 additions & 8 deletions tests/test_osm_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
# import custom python packages
# sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from wahoo_mc.osm_maps_functions import OsmMaps
from wahoo_mc.osm_maps_functions import get_tile_by_one_xy_combination_from_jsons
from wahoo_mc.osm_maps_functions import get_xy_coordinates_from_input
from wahoo_mc.osm_maps_functions import TileNotFoundError
from wahoo_mc.input import InputData
from wahoo_mc import file_directory_functions as fd_fct
from wahoo_mc import constants_functions as const_fct
from wahoo_mc import constants
from wahoomc.osm_maps_functions import OsmMaps
from wahoomc.osm_maps_functions import get_tile_by_one_xy_combination_from_jsons
from wahoomc.osm_maps_functions import get_xy_coordinates_from_input
from wahoomc.osm_maps_functions import TileNotFoundError
from wahoomc.input import InputData
from wahoomc import file_directory_functions as fd_fct
from wahoomc import constants_functions as const_fct
from wahoomc import constants


class TestOsmMaps(unittest.TestCase):
Expand Down
7 changes: 0 additions & 7 deletions wahoo_mc/__main__.py

This file was deleted.

File renamed without changes.
7 changes: 7 additions & 0 deletions wahoomc/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""
can be directly called via `python -m wahoomc -h`
"""
from wahoomc import main

if __name__ == '__main__':
main.run()
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import os

# import custom python packages
from wahoo_mc import constants
from wahoo_mc import file_directory_functions as fd_fct
from wahoomc import constants
from wahoomc import file_directory_functions as fd_fct

log = logging.getLogger('main-logger')

Expand Down
4 changes: 2 additions & 2 deletions wahoo_mc/downloader.py → wahoomc/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import logging

# import custom python packages
from wahoo_mc import file_directory_functions as fd_fct
from wahoo_mc import constants_functions as const_fct
from wahoomc import file_directory_functions as fd_fct
from wahoomc import constants_functions as const_fct

log = logging.getLogger('main-logger')

Expand Down
File renamed without changes.
Loading

0 comments on commit 592221c

Please sign in to comment.