consbio / mbtileserver

Basic Go server for mbtiles
ISC License
657 stars 104 forks source link

Use of stadiamaps? #173

Closed prologic closed 1 year ago

prologic commented 1 year ago

Why am I seeing the map preview accessing for example:

https://tiles.stadiamaps.com/tiles/stamen_toner_lite/10/949/594.png

? I've trying to serve up my own .mbtiles of the planet dataset from OSM and seeing lots of network requests to stadiamap.com rather than serving up tiles from the mbtileserver which I'm expecting. I thought it had something to do with the Leaflet library and preview templates, but I can't find any reference to stadiamaps.com anywhere in the source tree?!

What's going on here? 🤔

brendan-ward commented 1 year ago

@prologic apologies for not logging an issue sooner around this. We switched to Stamen basemaps in #148 , but unfortunately those have since been discontinued. Luckly, Stadia has provided free hosting of those and it looks like there are automatic redirects in place now. I think we'll switch over to Stadia properly when I have a chance to address this.

prologic commented 1 year ago

@brendan-ward Apologies, I had already worked out at least some of what was going on, and discovered where/how thes base maps were being hit. Thank you for the additional clarification.

I have a side-question now, where if I want to host my own basemaps? i'm having a really hard time finding openly available basemaps I can "just use". I thought maybe Open Street Maps, has this, but I don't think so, I think that's more of a large feature set of the planet and its many cities, roads, etc.

prologic commented 1 year ago

Basically your project mbtileserver is pretty close to what I need/want, which I'm hoping to build upon, but hmmm basemaps? 😅

brendan-ward commented 1 year ago

@prologic I don't create / host basemaps, so this isn't something in which I have much experience. I know it is possible to create basemaps from OpenStreetMap data, e.g., OpenMapTiles or several other tools that output mbtiles files, which you can then host using mbtileserver if you so choose.

Worth checking out, though separate from mbtileserver (i.e., supersedes the need for mbtileserver), is the very compelling work going on with Protomaps / PMTiles.

prologic commented 1 year ago

Thank you. Yeah I've also come across PMTiles as well, but I'm not yet sure how "mature" that is... I'll check out OpenMapTiles (thank you for the tip!)

prologic commented 1 year ago

@brendan-ward Appreciate you haven't done much in the way of self-hosting basemaps, but if happen to know something about this that I don't, i'd appreciate it.

I went and generate a (what I think is) basemap of Australia with the aforementioned tools provided by OpenMapTiles last night, it ran for about ~3-4hrs and successfully created an Australia.mbtiles output. I then reconfigured the basemap(s) in the mbtileserver leaflet map preview to use this as the basemap(s), but run into this error:

Error: Could not load image because of The source image could not be decoded.. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.

So I'm a bit lost here as to what leaflet is expecting to use as a "basemap" and what the tools provided by OpenMapTilers is generating? I'm a bit ouf of touch 😅 -- At this stage I just want to understand things 🤣

brendan-ward commented 1 year ago

I think OpenMapTiles is creating vector tiles rather than image tiles. There are currently 2 preview map engines that come with mbtileserver: Leaflet for image tiles, and Mapbox GL for vector tiles. That should be handled automatically when you go to the preview endpoint for the tileset you've published in mbtileserver. When it scans tilesets, it detects if they are image or vector tiles, and then based on that will return the correct preview template with Leaflet or Mapbox GL depending on the type.

Eventually I want to consolidate both of those preview templates to use maplibre-gl-js, but haven't had the time. Note that the previews are simply that; they aren't really intended as an extension point for you to display your tilesets publicly for a more complex map. In order to show the basemap vector tiles in the way you expect, you'll need to configure it with one of the map styles that I think is available through OpenMapTiles.

Is your issue that mbtileserver is not correctly detecting the tileset type? Or that you are doing something extra to try and add your basemap vector tiles to the Leaflet preview template?

prologic commented 1 year ago

Is your issue that mbtileserver is not correctly detecting the tileset type? Or that you are doing something extra to try and add your basemap vector tiles to the Leaflet preview template?

This. Trying to see if I can convince the code to serve up a custom basemap, of course I'm forgetting the sttles here I think so I have a bit more figuring out to do 😅

brendan-ward commented 1 year ago

Closing due to lack of activity; Stadia basemaps and basemaps in general handled in #147