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

fix:Modify usa local json file city name for fix download url append … #135

Conversation

mushroom11s
Copy link

Fix: modify the city name of the US local JSON file to fix the download URL append error.

@treee111
Copy link
Owner

Hi @mushroom11s,
thanks for this PR! 👍

What is the command / UI action causing the tool to break?
I assume the error is because of the URL creation here:

def build_url_for_country_osm_pbf_download(country):
"""
build the geofabrik download url to a countries' OSM file
"""
transl_c = const_fct.translate_country_input_to_geofabrik(country)
region = const_fct.get_geofabrik_region_of_country(country)
if region != 'no':
url = 'https://download.geofabrik.de/' + region + \
'/' + transl_c + '-latest.osm.pbf'
else:
url = 'https://download.geofabrik.de/' + transl_c + '-latest.osm.pbf'
return url

We could manage the conversion of _ to - you done in the json-files to be consistent in the Translate_Country mapping.
Translate_Country = {
'alaska': 'united_states_of_america',
'anguilla': 'central-america',
'bahrain': 'gcc-states',
'bosnia_and_herzegovina': 'bosnia-herzegovina',
'british_virgin_islands': 'central-america',
'british_indian_ocean_territory': 'asia',
'brunei': 'malaysia-singapore-brunei',

We might have less changes because each "country" needs only one change and not each occurrence.
Let's see if that would help and is OK for you! :-)

treee111 added a commit that referenced this pull request Jun 25, 2022
@treee111
Copy link
Owner

OK, I got it.

If I use your branch and call python -m wahoomc cli -co american_samoa I still get this error:
image

The mapping of the input to the geofabrik name of the country is needed. As mentioned before this would make the changes of the json files obsolete in my opinion.

I done the change as suggested by me in the comment above.
Could you please checkout if branch fix-usa_local_json_cityname_error-via-constants works for you for american_samoa.
If you like, you can takeover the changes to your branch and change the other countries in the same way.

Greetings :-)

@mushroom11s
Copy link
Author

mushroom11s commented Jun 26, 2022

Yes, I got this error when i downloading the map of Massachusetts,and then i found that many cities name are the same

@mushroom11s
Copy link
Author

All names that contain underlined cities have problems

Yes, I made this error downloading the map of Massachusetts,and then i found that many cities name are the same

treee111 added a commit that referenced this pull request Jun 26, 2022
treee111 added 2 commits June 26, 2022 14:34
another way as initially done via treee111#135 (changes in json files)
@mushroom11s mushroom11s deleted the fix-usa_local_json_cityname_error branch June 27, 2022 02:06
treee111 added a commit that referenced this pull request Jun 27, 2022
another way as initially done via #135 (changes in json files)
treee111 added a commit that referenced this pull request Jun 27, 2022
* get correct geofabrik URL via conversion of `_` to `-`

another way as initially done via #135 (changes in json files)

* review changes

- remove dublicate key
- save .osm.pbf file with geofabrik name
- move two functions into one
- commonwealth_of_the_northern_mariana_islands still downloads two similar .osm.pbf files
@treee111
Copy link
Owner

Hi @mushroom11s, thanks again for pointing out this _ to - thing!
I implemented the presented solution in #137
feel free to test it on branch develop :-)

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.

2 participants