Hauk icon indicating copy to clipboard operation
Hauk copied to clipboard

Support vector tiles for drawing the map

Open maximbaz opened this issue 3 years ago • 3 comments

I tried to research the reasons for why a map is so blurry for me in the browser (https://github.com/bilde2910/Hauk/issues/122#issuecomment-695830956) and found the following:

  • By default, leaflet is using 256x256px tile sizes (which provide a terrible quality on HiDPI screens)
  • Some providers like Mapbox provide now 512x512px tiles (which is still blurry, but a bit better - and requires code modification as per below)
  • Some providers (again like Mapbox) provide vector tiles, which is the only format that will avoid any kind of blur on HiDPI screens, but this requires changing code even further, possibly adding leaflet plugin that can render vector tiles.

It would be really nice to support vector tiles format to have a beautiful map 🙂


By the way, this link is no longer valid:

https://github.com/bilde2910/Hauk/blob/899e52584422446d8448b25a159d2ebd671a59e6/backend-php/include/config-sample.php#L217-L218

The correct link is now this:

https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token=YOUR_ACCESS_TOKEN

But as per migration guide code here will have to be adjusted too to add tileSize: 512 and zoomOffset: -1 (which will break other tile providers I suppose)

https://github.com/bilde2910/Hauk/blob/899e52584422446d8448b25a159d2ebd671a59e6/frontend/main.js#L222-L225

If you want to support Mapbox raster format, I would imagine tileSize and zoomOffset have to become configurable.

maximbaz avatar Sep 20 '20 22:09 maximbaz

Careful around Mapbox, not everything is FOSS.

Ref.: https://forum.f-droid.org/t/updated-distribution-license-for-mapbox-mobile-maps-sdk/10201

licaon-kter avatar Sep 21 '20 04:09 licaon-kter

Sorry for being late to this issue. This should definitely be added to Hauk as a configurable option. I'll get around to that by next release. As for @licaon-kter's concern; Hauk only uses Mapbox via Leaflet as an example, and currently defaults to OpenStreetMap directly. Setting up Mapbox with Hauk is thus a server-side config option only. The Android client doesn't use any mapping SDK currently, and shouldn't be affected by Mapbox' licensing change.

bilde2910 avatar Nov 12 '20 10:11 bilde2910

Let me know if you want some help @bilde2910 😉

maximbaz avatar Nov 12 '20 11:11 maximbaz