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

Calculate relevant tiles using a URL instead of static json files #13

Closed
treee111 opened this issue Jul 2, 2021 · 6 comments · Fixed by #68
Closed

Calculate relevant tiles using a URL instead of static json files #13

treee111 opened this issue Jul 2, 2021 · 6 comments · Fixed by #68
Labels
enhancement New feature or request
Milestone

Comments

@treee111
Copy link
Owner

treee111 commented Jul 2, 2021

Use https://download.geofabrik.de/index-v1.json for map creation instead of the wahoo json files in folder common_resources\json

The relevant tiles are calculated here:

json_file_path = os.path.join (COMMON_DIR,
'json', region, input_argument1 + '.json')
with open(json_file_path) as json_file:
tiles_from_json = json.load(json_file)
json_file.close()
if tiles_from_json == '' :
print ('! Json file could not be opened.')
sys.exit()

@treee111 treee111 changed the title To calculate the relevant tiles, use a URL instead of static json files Calculate relevant tiles using a URL instead of static json files Jul 2, 2021
@treee111 treee111 added enhancement New feature or request infrastructure Infrastructure labels Jul 2, 2021
@Ebe66
Copy link
Contributor

Ebe66 commented Aug 12, 2021

Hi,
This may sound logical (and maybe it is) but it's not as easy as it may sound and what would be the benefit?

The current json files where manually created by Henk as far as I know. They are based upon the Wahoo mappack-gzip.json file.
The Wahoo file has info on routing tiles and a list of tiles used for the country/region. This is all Wahoo needs at this point, which tiles to download from their server when you add a map.
For creating these tiles you need more info so Henk has added the bounding box coordinates for each tile and the necessary countries to download to create complete tiles (btw, without checking, I think you might have a problem there when in your gui (saw a screenshot) you select to not download neighboring countries. Normally this results in incomplete roads in the border area).
The geofabrik json file only contains the coordinates of an outline for the country. That on it's own is not such a problem to translate to a rectangle of blocks needed. The (no, a) problem is that it does not tell us which additional maps are needed.
I have been searching for a "slippy tile at zoom level 8 contains parts of countries ..." piece of code but have not found it yet.
And again, what would be the benefit??

It would be great if there was a place where you can download the raw data (like geofabrik) of a slippy tile. Then your question would be possible and it would solve some "difficulties" between how Wahoo and Geofabrik etc see the world. For example, Wahoo adds the tiles of France's colonial history, or how to put it, to the map of France. Geofabrik does not. There are solutions for that, but they are not for the average Joe I'm afraid. One solution is to download the planet file, convert each tile and collect the necessary tiles for a map pack. Problem: the bigger the source file the longer it takes to split out a tile. tried it once with europe, believe me it's no solution. the other option is to create a local database containing the planet file and read from the database. Suffice to say I am trying to get the database filled for almost 3 months now. (keep running out of space)

@Ebe66
Copy link
Contributor

Ebe66 commented Aug 26, 2021

I "spoke" to Henk who gave me an idea and a little start. So I have made a new version that uses the Geofabrik json file. I uploaded it today to Higli's HiDrive

@treee111
Copy link
Owner Author

Hi!

thanks for commenting 👍 , I didn't got notified or haven't seen it.
I included my comments into your post.

Hi,
This may sound logical (and maybe it is) but it's not as easy as it may sound and what would be the benefit?

Henk mentioned this some time ago as an enhancement to always be up-to-date here and not rely on the "static" json files in the repo.

The current json files where manually created by Henk as far as I know. They are based upon the Wahoo mappack-gzip.json file.
The Wahoo file has info on routing tiles and a list of tiles used for the country/region. This is all Wahoo needs at this point, which tiles to download from their server when you add a map.
For creating these tiles you need more info so Henk has added the bounding box coordinates for each tile and the necessary countries to download to create complete tiles (btw, without checking, I think you might have a problem there when in your gui (saw a screenshot) you select to not download neighboring countries. Normally this results in incomplete roads in the border area).

Legit point!
For testing purposes I sometimes calculate one tile only and put it on my device to check during the ride.
In this tile there is only one county involved and the border of the tile is cutted as a square (as I imagined it to be).
For sure, this can be different if a real border-country is involved. As this is a optional parameter one could uncheck if problems arise from this.
I can understand the feature request to not download (and process) border countries if someone lives in the middle of a country with many border countries and does not comes in boarder regions of this country (i.e. China, Russia)

The geofabrik json file only contains the coordinates of an outline for the country. That on it's own is not such a problem to translate to a rectangle of blocks needed. The (no, a) problem is that it does not tell us which additional maps are needed.
I have been searching for a "slippy tile at zoom level 8 contains parts of countries ..." piece of code but have not found it yet.
And again, what would be the benefit??

It would be great if there was a place where you can download the raw data (like geofabrik) of a slippy tile. Then your question would be possible and it would solve some "difficulties" between how Wahoo and Geofabrik etc see the world. For example, Wahoo adds the tiles of France's colonial history, or how to put it, to the map of France. Geofabrik does not. There are solutions for that, but they are not for the average Joe I'm afraid. One solution is to download the planet file, convert each tile and collect the necessary tiles for a map pack. Problem: the bigger the source file the longer it takes to split out a tile. tried it once with europe, believe me it's no solution. the other option is to create a local database containing the planet file and read from the database. Suffice to say I am trying to get the database filled for almost 3 months now. (keep running out of space)

What do you mean with a "slippy tile"? Some tile at a given X/Y position?

Sound clear! To be honest I didn't get so deep into this feature that I found all this!
I just didn't want to forget this feature to be implemented at some point.

@treee111
Copy link
Owner Author

treee111 commented Aug 28, 2021

I "spoke" to Henk who gave me an idea and a little start. So I have made a new version that uses the Geofabrik json file. I uploaded it today to Higli's HiDrive

wohooo sounds great! 👍

Do you like to implement it in this repository as Pull Request?

On the other hand I can try to integrate the changes into this version if you allow so?
I suppose you added lines 270 to 333 in the file wahoo-map-creator-osmosis.py relevant to the issue?

What do you think about having the python files and other needed stuff in a place like Github rather than on HiDrive?
In my opinion there are some advantages and the initital setup (installing the needed tools per OS) is identical.
I invited you as collaborater in case you don't want to fork but create a branch directly in this repo.

oh and slippy tiles is the openstreetmaps name for the x/y coordinates system

@treee111 treee111 removed the infrastructure Infrastructure label Aug 28, 2021
@Ebe66
Copy link
Contributor

Ebe66 commented Aug 28, 2021

Do what whatever you want with it. ;-) I don't have a clue as to how github works so it's up to you I'm afraid...
There are several small changes throughout the program, and keep an eye on the hidrive, I already updated the version there a few times in the last day

@treee111
Copy link
Owner Author

treee111 commented Sep 9, 2021

hehe I might look into that if I have time. Thanks!

If you like I would be willing to introduce you to Github to use that as central point for the coding to generate Wahoo-maps.

The main advantages are in my opinion:

  • no double-implementation effort
  • multi platform support (OSX, Windows, Linux)
  • transparent view of code changes
  • easy possibility to work with many developers on many features in parallel

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
2 participants