treee111 / wahooMapsCreator

Create maps for Wahoo device based on latest OSM maps
GNU General Public License v3.0
261 stars 26 forks source link

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

Closed treee111 closed 3 years ago

treee111 commented 3 years ago

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: https://github.com/treee111/wahooMapsCreator/blob/6490e6a4e57f6aa0935ed19d9a970895fd365cfe/common_resources/file_directory_functions.py#L62-L70

Ebe66 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

Ebe66 commented 3 years ago

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 commented 3 years ago

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: