maptiler / tileserver-gl

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
https://tileserver.readthedocs.io/en/latest/
Other
2.24k stars 639 forks source link

Alternating missing tiles when using multiple non-overlapping data sources #485

Open vchen0 opened 4 years ago

vchen0 commented 4 years ago

Hi,

I'm trying to build an offline, self-hosted map solution that supports using multiple data sets in order to allow customers to upload maps as needed. However, I'm running into an issue with the tileserver loading missing tiles when I specify multiple sources in my tileserver config.

For example, in my tileserver config.json I have

  "data": { 
    "west": {
      "mbtiles": "us-west.mbtiles"
    },
    "midwest": {
      "mbtiles": "us-midwest.mbtiles"
    }
  }

And in my style.json I have:

  "sources":{
    "openmaptiles":{
      "type":"vector",
      "tiles":[
        "https://local.domain.com/data/midwest/{z}/{x}/{y}.pbf",
        "https://local.domain.com/data/west/{z}/{x}/{y}.pbf"
      ]
    }

I'm using leaflet.js to load the map tiles and the resulting map looks like the following, with alternating tiles missing: Screen Shot 2020-10-22 at 9 25 23 AM

And the tileserver log shows that tiles are being fetched from each source in alternating order whereas for this area all the tiles should be loaded from the "west" source.

GET /data/west/13/1432/3309.pbf 200 1.292 ms - 28549
GET /data/midwest/13/1432/3308.pbf 204 1.433 ms - -
GET /data/midwest/13/1429/3309.pbf 204 1.327 ms - -
GET /data/west/13/1433/3308.pbf 200 1.263 ms - 17368
GET /data/midwest/13/1433/3309.pbf 204 0.705 ms - -
GET /data/west/13/1429/3308.pbf 200 2.445 ms - 17486

I could run a daemon that detects new tilesets and merges the them using tile-join and that is my backup solution, but the merge process is slow so I'm wondering if simply serving multiple sources can produce a better user experience. Anyone know how to resolve this so only valid tiles from the relevant source are served?

Thanks for any help!

NasH5169 commented 4 years ago

Just my 2 cents: It must be interesting to know what is the behavior of Leaflet when a source has multiple sources urls.

In other words, is this issue is due to the map engine or TileServer?

neelakandan-dhanigachalam commented 3 years ago

Hi Fricna,

Has this issue been resolved? If so, how did you resolve this issue? Please share the same. We are encountering a similar issue. https://github.com/maptiler/tileserver-gl/issues/519

Thanks.

xabbu42 commented 3 years ago

This is the correct behaviour according to documentation (https://github.com/mapbox/tilejson-spec/tree/master/2.2.0):

// REQUIRED. An array of tile endpoints. {z}, {x} and {y}, if present, // are replaced with the corresponding integers. If multiple endpoints are specified, clients // may use any combination of endpoints. All endpoints MUST return the same // content for the same URL. The array MUST contain at least one endpoint.

This issue can be closed.