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

timeout when requesting wmts tiles #915

Closed a14stoner closed 1 year ago

a14stoner commented 1 year ago

Hello everyone,

I am using the latest tileserer-gl version 4.4.10.

I have a combination of vector-data and raster-data:

image

When checking both layer basemap_hillshade:

image

and basemap_hdpi

image

everything works well. also when checking the combination of both:

image

it works well. its a little bit slow but ok.

Requesting the wmts capabilities i also get a result. But when opening the layer via QGIS i always get timeouts and no png tiles are coming back from tileserver.

my config.json looks like this:

{
  "options": {
    "paths": {
      "root": "/data",
      "fonts": "basemap_hdpi/fonts",
      "styles": ""
    },
    "log_level": "debug",
    "serveStaticMaps": true,
    "formatQuality": {
      "jpeg": 90,
      "webp": 90
    },
    "maxSize": 8192,
    "pbfAlias": "pbf"
  },
  "styles": {
    "basemap_hdpi": {
      "style": "basemap_hdpi/styles/style.json",
      "tilejson": {
        "bounds": [8.8587,46.3723,17.1608,49.0205],
        "format": "vector"
      }
    }
  },
  "data": {
    "basemap_hdpi": {
      "mbtiles": "bmapv_hdpi.mbtiles"
    },
    "basemap_hillshade": {
      "mbtiles": "bmap_ht.mbtiles"
    }
  }
}

I dont see anything in the logs of the container although i configured "log_level":"debug"

GET /styles/basemap_hdpi/16/35163/23053.png - - - - ms
GET /styles/basemap_hdpi/16/35163/23052.png - - - - ms
GET /styles/basemap_hdpi/16/35163/23050.png - - - - ms
GET /styles/basemap_hdpi/15/17581/11526.png - - - - ms
GET /styles/basemap_hdpi/15/17579/11526.png - - - - ms
GET /styles/basemap_hdpi/15/17580/11526.png - - - - ms
GET /styles/basemap_hdpi/15/17581/11525.png - - - - ms
GET /styles/basemap_hdpi/15/17581/11524.png - - - - ms
GET /styles/basemap_hdpi/15/17578/11523.png - - - - ms
GET /styles/basemap_hdpi/15/17578/11525.png - - - - ms
GET /styles/basemap_hdpi/15/17578/11526.png - - - - ms
GET /styles/basemap_hdpi/15/17578/11524.png - - - - ms
GET /styles/basemap_hdpi/15/17581/11523.png - - - - ms
GET /styles/basemap_hdpi/15/17579/11523.png - - - - ms
GET /styles/basemap_hdpi/15/17580/11523.png - - - - ms
GET /styles/basemap_hdpi/15/17579/11527.png - - - - ms
GET /styles/basemap_hdpi/15/17581/11527.png - - - - ms
GET /styles/basemap_hdpi/15/17580/11527.png - - - - ms
GET /styles/basemap_hdpi/15/17578/11527.png - - - - ms
GET /styles/basemap_hdpi/15/17582/11526.png - - - - ms
GET /styles/basemap_hdpi/15/17582/11524.png - - - - ms
GET /styles/basemap_hdpi/15/17582/11523.png - - - - ms
GET /styles/basemap_hdpi/15/17582/11525.png - - - - ms
GET /styles/basemap_hdpi/15/17582/11527.png - - - - ms

any idea why this is so slow / doesnt work?

acalcutt commented 1 year ago

Are you able to view this in the "Raster" viewer in your style? wmts is rendered in a similar way to raster, so it is possible you are getting some error in your style with maplibre-native. Do you see any warnings at the command prompt when you look at raster view?

a14stoner commented 1 year ago

When i try it with raster it also shows nothing

image

but i get HTTP 400 Error (Bad Request) errors in log:

GET /styles/basemap_hdpi/7/64/45.vector 400 14 - 0.350 ms
GET /styles/basemap_hdpi/7/70/43.vector 400 14 - 0.338 ms
GET /styles/basemap_hdpi/7/63/43.vector 400 14 - 0.541 ms
GET /styles/basemap_hdpi/7/65/43.vector 400 14 - 0.688 ms
GET /styles/basemap_hdpi/7/72/43.vector 400 14 - 0.859 ms
GET /styles/basemap_hdpi/7/64/42.vector 400 14 - 0.981 ms
GET /styles/basemap_hdpi/7/71/47.vector 400 14 - 1.117 ms
GET /styles/basemap_hdpi/7/74/46.vector 400 14 - 0.368 ms
GET /styles/basemap_hdpi/7/62/42.vector 400 14 - 0.833 ms
GET /styles/basemap_hdpi/7/62/47.vector 400 14 - 0.957 ms
GET /styles/basemap_hdpi/7/74/47.vector 400 14 - 0.409 ms
GET /styles/basemap_hdpi/7/61/44.vector 400 14 - 0.354 ms
GET /styles/basemap_hdpi/7/75/44.vector 400 14 - 0.332 ms
GET /styles/basemap_hdpi/7/61/45.vector 400 14 - 0.410 ms
GET /styles/basemap_hdpi/7/75/45.vector 400 14 - 0.421 ms
GET /styles/basemap_hdpi/7/61/43.vector 400 14 - 0.402 ms
GET /styles/basemap_hdpi/7/75/43.vector 400 14 - 0.606 ms
GET /styles/basemap_hdpi/7/61/46.vector 400 14 - 0.730 ms
GET /styles/basemap_hdpi/7/75/46.vector 400 14 - 0.427 ms
GET /styles/basemap_hdpi/7/61/42.vector 400 14 - 0.350 ms
GET /styles/basemap_hdpi/7/75/42.vector 400 14 - 0.673 ms
GET /styles/basemap_hdpi/7/61/47.vector 400 14 - 0.784 ms
GET /styles/basemap_hdpi/7/75/47.vector 400 14 - 0.370 ms

When opening the Url in the browser i get the following error:

Invalid format

P.S. Vektor Viewer works:

image

a14stoner commented 1 year ago

Ping. Maybe someone can help me ;)

a14stoner commented 1 year ago

Ping. Maybe someone can help me :D

acalcutt commented 1 year ago

I notice in your requests it is looking for ".vector" files, but I think that is the wrong extension.

/styles/basemap_hdpi/7/64/45.vector seems strange. maybe it is because you are specifying "format": "vector" in your style. If you remove that does the behavior change?

typically a rendered style would be in png format, like the images in this network tab when I look at a raster map image

a14stoner commented 1 year ago

you were right. removing the "format": "vector" in my config.json resolved the error but no tiles png files are shown: the requests are pending for a very long time:

image

the log from tileserver looks like this:

GET /styles/basemap_hdpi/15/17568/11430.png - - - - ms
GET /styles/basemap_hdpi/15/17567/11428.png - - - - ms
GET /styles/basemap_hdpi/15/17567/11431.png - - - - ms
GET /styles/basemap_hdpi/15/17567/11430.png - - - - ms
GET /styles/basemap_hdpi/15/17568/11428.png - - - - ms
GET /styles/basemap_hdpi/16/35139/22863.png - - - - ms
GET /styles/basemap_hdpi/16/35139/22860.png - - - - ms
GET /styles/basemap_hdpi/16/35136/22860.png - - - - ms
GET /styles/basemap_hdpi/16/35136/22863.png - - - - ms
GET /styles/basemap_hdpi/16/35139/22861.png - - - - ms
GET /styles/basemap_hdpi/17/70277/45726.png - - - - ms
GET /styles/basemap_hdpi/17/70275/45724.png - - - - ms
GET /styles/basemap_hdpi/17/70274/45722.png - - - - ms
GET /styles/basemap_hdpi/17/70277/45722.png - - - - ms
GET /styles/basemap_hdpi/17/70274/45726.png - - - - ms
GET /styles/basemap_hdpi/17/70278/45724.png - - - - ms
GET /styles/basemap_hdpi/17/70277/45724.png - - - - ms
GET /styles/basemap_hdpi/17/70278/45725.png - - - - ms
GET /styles/basemap_hdpi/17/70277/45725.png - - - - ms
acalcutt commented 1 year ago

I've also seen empty tiles like that from maplibre-native when fonts or sprites are missing that are specified in your style.

What are you specifying for fonts/glyphs in your style? do you see any warnings about fonts?

acalcutt commented 1 year ago

Also, sometimes I find issues in my style by opening the developer console and going into the vector view. The console will sometimes log errors in your style, that will make the raster view not render.

a14stoner commented 1 year ago

In the vector view no errors:

image

also in logs no error:

GET /data/basemap_hdpi/12/2199/1435.pbf 200 47559 - 7.255 ms
GET /data/basemap_hdpi/12/2199/1434.pbf 200 32437 - 11.400 ms
GET /data/basemap_hdpi/12/2197/1434.pbf 200 41304 - 19.367 ms
GET /data/basemap_hdpi/12/2198/1435.pbf 200 44215 - 20.549 ms
GET /data/basemap_hdpi/12/2198/1434.pbf 200 71737 - 20.921 ms
GET /data/basemap_hdpi/12/2197/1435.pbf 200 68611 - 22.182 ms
GET /data/basemap_hillshade/13/4397/2868.jpg - - - - ms
GET /data/basemap_hillshade/13/4396/2870.jpg 200 15406 - 16.131 ms
GET /data/basemap_hillshade/13/4397/2870.jpg 200 16822 - 18.522 ms
GET /data/basemap_hillshade/13/4396/2869.jpg 200 15400 - 19.358 ms
GET /data/basemap_hillshade/13/4397/2869.jpg 200 16602 - 12.692 ms
GET /data/basemap_hillshade/13/4398/2870.jpg 200 17298 - 13.441 ms
GET /data/basemap_hdpi/13/4396/2870.pbf 200 38590 - 7.218 ms
GET /data/basemap_hdpi/13/4397/2870.pbf 200 21960 - 3.590 ms
GET /data/basemap_hdpi/13/4397/2869.pbf 200 23812 - 326.214 ms
GET /data/basemap_hillshade/13/4398/2869.jpg 200 17629 - 1.637 ms
GET /data/basemap_hdpi/13/4398/2869.pbf 200 32382 - 7.251 ms
GET /data/basemap_hdpi/13/4396/2869.pbf 200 78099 - 16.757 ms
GET /data/basemap_hdpi/13/4398/2870.pbf 200 53980 - 17.118 ms

i attached the styles file then you can check it out.

style.json

acalcutt commented 1 year ago

Looking at your config and style, my guess is this is font related.

In your config.json you are saying the fonts are in basemap_hdpi/fonts , but in your style you are also including the full path to the fonts. I think this would append the two together, so it would be looking for fonts at /data/basemap_hdpi/fonts/basemap_hdpi/fonts/{fontstack}/{range}.pbf

The fonts don't matter as much in vector view, because the maplibre-gl-js based viewer is able to pull missing fonts from the browser. Maplibre-native however needs the fonts to exists because it is not able to fall back to anything.

assuming your folder structure looks like

/data (mbtiles/config here)
/data/basemap_hdpi/sprites/sprite.json
/data/basemap_hdpi/sprites/sprite.png
/data/basemap_hdpi/fonts/Arial Bold/{range}.pbf
/data/basemap_hdpi/fonts/Arial Regular/{range}.pbf
/data/basemap_hdpi/styles/style.json

I would change my config so the fonts and sprite paths are specified

config.json

    "paths": {
      "root": "/data",
      "fonts": "basemap_hdpi/fonts",
      "sprites": "basemap_hdpi/sprites",
      "styles": ""
    },

then I would change my style to remove the font and sprite paths. Also I would use the config data ids to link to my data sources without using a full url.

style.json

  "sprite": "sprite",
  "glyphs": "{fontstack}/{range}.pbf",
  "sources": {
    "esri": {
      "type": "vector",
      "url": "mbtiles://{basemap_hdpi}"
    },
    "basemap_hillshade": {
      "type": "raster",
      "url": "mbtiles://{basemap_hillshade}"
    }
  },

typically in my styles, I keep the sprites in with the style, so my config I usually don't specify a sprite path and in my style I use "sprite": "{styleJsonFolder}/sprite", in your case the sprites look like they are in their own folder, so I think specifying the folder in config.json then omitting the path makes sense.

In your 'basemap_hdpi/fonts' folder do the 'Arial Bold' and 'Arial Regular' font glyphs exists? I don't see that font used in styles much, so if you don't have them you could create them by dragging the windows arial font into https://maplibre.org/font-maker/

I would expect something like the attached in the end, though I don't have your mbtiles files to test it. basemap_hdpi.zip

a14stoner commented 1 year ago

oh my god i used your style.json and it works now...

ET /styles/basemap_hdpi/7/68/44.png 304 - - 0.901 ms
GET /styles/basemap_hdpi/7/68/43.png 200 11001 - 1357.422 ms
GET /styles/basemap_hdpi/7/69/43.png 200 8560 - 1357.954 ms
GET /styles/basemap_hdpi/7/69/44.png 200 131129 - 2359.188 ms
GET /styles/basemap_hdpi/7/68/45.png 200 53462 - 5092.368 ms
GET /styles/basemap_hdpi/7/67/44.png 200 49280 - 5092.946 ms
GET /styles/basemap_hdpi/7/69/45.png 200 43031 - 5093.355 ms
GET /styles/basemap_hdpi/7/70/46.png 200 355 - 2788.002 ms
GET /styles/basemap_hdpi/7/71/45.png 200 872 - 2791.615 ms
GET /styles/basemap_hdpi/7/71/46.png 200 355 - 34.272 ms
GET /styles/basemap_hdpi/7/66/42.png 200 872 - 51.770 ms
GET /styles/basemap_hdpi/7/67/46.png 200 355 - 47.366 ms
GET /styles/basemap_hdpi/7/67/45.png 200 34399 - 24.732 ms
GET /styles/basemap_hdpi/7/71/42.png 200 872 - 245.890 ms
GET /styles/basemap_hdpi/7/70/42.png 200 872 - 445.860 ms
GET /styles/basemap_hdpi/7/66/44.png 200 872 - 504.554 ms
GET /styles/basemap_hdpi/7/69/42.png 200 872 - 29.375 ms
GET /styles/basemap_hdpi/7/70/44.png 200 11157 - 465.519 ms
GET /styles/basemap_hdpi/7/71/44.png 200 872 - 801.389 ms
GET /styles/basemap_hdpi/7/69/46.png 200 355 - 781.242 ms
GET /styles/basemap_hdpi/7/66/45.png 200 872 - 1260.556 ms
GET /styles/basemap_hdpi/7/67/42.png 200 872 - 808.495 ms
GET /styles/basemap_hdpi/7/71/43.png 200 872 - 13.318 ms
GET /styles/basemap_hdpi/7/70/45.png 200 3699 - 281.541 ms
GET /styles/basemap_hdpi/7/68/42.png 200 872 - 270.398 ms
GET /styles/basemap_hdpi/7/70/43.png 200 3617 - 279.223 ms
GET /styles/basemap_hdpi/7/65/44.png 200 355 - 265.250 ms
GET /styles/basemap_hdpi/7/67/43.png 200 6145 - 284.303 ms
GET /styles/basemap_hdpi/7/66/46.png 200 355 - 20.264 ms
GET /styles/basemap_hdpi/7/68/46.png 200 355 - 268.628 ms
GET /styles/basemap_hdpi/7/66/43.png 200 872 - 280.848 ms
GET /styles/basemap_hdpi/7/65/43.png 200 355 - 258.485 ms
GET /styles/basemap_hdpi/7/72/44.png 200 355 - 266.305 ms
GET /styles/basemap_hdpi/7/72/43.png 200 355 - 24.006 ms
GET /styles/basemap_hdpi/7/65/45.png 200 355 - 14.637 ms
GET /styles/basemap_hdpi/7/65/42.png 200 355 - 16.128 ms
GET /styles/basemap_hdpi/7/72/45.png 200 355 - 23.167 ms
GET /styles/basemap_hdpi/7/72/42.png 200 355 - 27.582 ms
GET /styles/basemap_hdpi/7/65/46.png 200 355 - 22.555 ms
GET /styles/basemap_hdpi/7/72/46.png 200 355 - 19.289 ms

thanks a million!!!!

image