SignalK / freeboard-sk

Chartplotter implementation for Signal K servers
Apache License 2.0
35 stars 27 forks source link

Overlap between mbtiles files. #136

Closed Merange closed 6 months ago

Merange commented 6 months ago

Hello again,

I test to make overlas with 2 mbtiles on the same area to be sure to have the best map at any pint.

But some times there are areas with lower resolution. You can see this trouble in the follwing image even if it is not very clearly image

I think it is because the tiles are sometimes greter than the area defined in the file

for example in this case the area is the red rectangle but the 4 differents tiles cover a larger area image

In another file, I create a map like this image

In the second file, I suppose that the area marked below is present in the zoom level tile 6 but not in the area of the mbtiles file (marked in yellow) so it is not present in all zoom level and this area might be shown at level 7 even if a better version is in the 1rst file image

Thank you

panaaj commented 6 months ago

If your issue is having a higher resolution chart appear "on top" where it overlaps with a chart of lower resolution, then you can assign the order of charts to determine which ones appear on top of others.

To do this, go to the charts list and click the Re-order Charts button. image

You can then drag the listed charts to determine which ones appear on top of others.

Merange commented 6 months ago

Yes I understand the effect of the order I try to show you the trouble in another way When the Atlantique mbtiles file is over the Manche one I view this map When you look at the result, you can see 3 level of zoom image

If I reorder the and put the Atlantique above the Manche , it is fine image

but I have now the trouble in this area which was fine when the Atlantique was above the Manche image

Here are the metadata of the 2 files image image So in the Atlantique mbtiles files the latitudes above 48.517N of this file are not valid

All zoom tiles are not available above 48.517 even if some lower zoom tiles are availables for these latitudes. In my example tiles with zoom above 10 are not present above 48.517 in the Atlantique file image image

panaaj commented 6 months ago

Sorry, but I'm not quite clear what the issue is or what the solution would look like. It seems to be a chart creation issue.

If charts overlap then the layering is going to determine what is visible.

Freeboard-SK uses the chart metadata to determine the parameters used when displaying charts.

Merange commented 6 months ago

For me the issue is in the exploitation of the metadata. The 2 mbtiles files have consistent metatdata. The metadata indicates the area covered by all the tiles, but the tiles for the lower zoom are larger than the area covered by all the tiles I've made an mbtiles files with zoom from 1 to 11 to cover all France. In zoom level 1 or 2, all the world is covered but at level 11 only the red square is covered image Here are the metadata image

In my previous message, we can see the Atlantique charts are valid for latitudes below 48.517 but Freeboard-Sk display tiles from this file beyond 48.517 even if there not more tile in this file at the zoom level 10.6. So the display is not yet clear beyond 48.517 because the only available tiles are with lower zoom levels. The tiles beyond 48.517 might be displayed from the Manche file which have correct tiles for these latitudes.

tkurki commented 6 months ago

This screenshot looks to me like one tile has failed to load and it is showing the lower res and it is not a question of bounds, because there is no lat or lon edge beyond which things would not work properly.

image

Have you checked with browser's dev tools / network tab what tiles Fb is trying to retrieve and if they succeed?

This kind of issues are pretty hard to debug over GH issue comments instead of trying things out yourself. Can you make your sk server accessible remotely or share (privately) your mbtiles files?

panaaj commented 6 months ago

Is it possible to provide the chart files so I can see the behaviour?

As Freeboard-SK uses the OpenLayers library to render maps based on the metadata from the mbtiles file, how tiles are processed and ultimately displayed will be determined by the OpenLayers code.

With access to the chart files I will at least be able to see the tiles being fetched to determine what possible solution there may be.

Merange commented 6 months ago

Thank you for your answers.

No trouble I post the mbtiles files here https://drive.proton.me/urls/MVMKZHFKJR#0cpO6EgTDumY and here https://drive.proton.me/urls/R66K58A9V8#gOFmcMukr1sg

Yes I have 404 error on the tiles covering the blured area

panaaj commented 6 months ago

Can this be closed?

Merange commented 6 months ago

Do you have made some modification in the code or library ? If not, the issue is always present.

Can you analyze my files ?

panaaj commented 6 months ago

I have viewed the behaviour with the chart files supplied. Using Atlantique 1-12 as the only chart selected which has a minZoom=1 and maxZoom=12, I am observing many 404 errors fetching tiles when changing zoom levels e.g. 2 to 3. These missing tiles would normally overwrite the tiles loaded from the previous zoom levels, but instead the previous tiles remain as the chart is still within the min/max zoom range.

So the issue you are experiencing seems to be related to the missing tiles for the various zoom levels between 1 & 12.

Merange commented 6 months ago

Hi,

Oh yes that's right but in this case, if you look in another file, you can find these tiles and display them.

Now you only display the tiles available in the current file. If the tile is not present, you do the best from the current file. I suppose you change of file only for the tiles not declared included in the bounds information of the metadata table. The URL for the tile of a mbtiles file contains the name of the file.

GET /signalk/v1/api/resources/charts/Atlantique%201-12/11/1001/704 404 0.863 ms - 9

If you consider all the mbfiles as a one source, you can try to find out a better tile from another file if there is a better one. It's quite the same trouble as the issue 136.

panaaj commented 6 months ago

Chart files are displayed as layers.

There is no concept of combining files into a single layer to treat them as one chart. This is not how it is intended to work.