onthegomap / maplibre-contour

Render contour lines from raster DEM tiles in maplibre-gl-js
https://onthegomap.github.io/maplibre-contour/
Other
155 stars 15 forks source link

Adding multiple URLs for DemSource #71

Open flemmens opened 11 months ago

flemmens commented 11 months ago

Thanks for this great plugin :)

When initializing a new DemSource, would it be possible to provide an array of URLs in order to speed up the process with parallel download the same way it is done for regular sources in MapLibre ?

this.demSource = new mlcontour.DemSource({
  url: [
    "https://tiles1.mysource.com/folder/{z}/{x}/{y}.png",
    "https://tiles2.mysource.com/folder/{z}/{x}/{y}.png",
    "https://tiles3.mysource.com/folder/{z}/{x}/{y}.png",
    "https://tiles4.mysource.com/folder/{z}/{x}/{y}.png"
  ],
  encoding: "terrarium",
  maxzoom: 14,
  worker: true,
  cacheSize: 100,
  timeoutMs: 10000
})

Thank you.

msbarry commented 11 months ago

Thanks for reaching out. This plugin could replicate all tile fetching functionality from maplibre (multiple urls, tilejson, custom protocols, callbacks to transform the request, etc.) but that adds quite a bit to the plugin size and complexity and will be a moving target as maplibre evolves. A better route might be to expose an API from maplibre that lets you fetch a tile from a source that it knows about?

Also regarding this specific request, are your tiles served over http/1.1 or http/2? If they are served over http/2 then the multiple urls shouldn't be necessary since http/2 doesn't cap at 6 connections per domain like 1.1 did.