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.19k stars 633 forks source link

Raster tiles file recognized as vector tiles #1258

Closed veitbjarsch closed 4 months ago

veitbjarsch commented 4 months ago

I've set up a tile server and created a mbtiles file which contains raster tiles. But when I reference the file inside the data prop, it states that the containing files are vector-file.

I could not find any documentation how to manually address this issue. So it might be a bug or do I missing something?

image

config.json

    "options": {
        "paths": {
            "root": "/data",
            "mbtiles": "/data"
        },
        "maxScaleFactor": 3,
        "maxSize": 2048,
        "pbfAlias": "pbf",
        "serveAllFonts": false,
        "serveAllStyles": false,
        "serveStaticMaps": true,
        "tileMargin": 0
    },
    "styles": {
        "snow": {
            "style": "style.json",
            "tilejson": {
                "bounds": [
                    -180,
                    -85.0511,
                    180,
                    85.0511
                ]
            }
        }
    },
    "sources": {
        "snow": {
            "url": "mbtiles://snow.raster.mbtiles",
            "type": "raster"
        }
    },
    "data": {
        "snow": {
            "mbtiles": "snow.raster.mbtiles",
             "type": "raster"
        }
    }
}
acalcutt commented 4 months ago

My guess would be your mbtiles file is missing format in the metadata table. I am pretty sure if format is not specified it defaults to pbf vector tiles. You can check this with a sqlite editor, like

# sqlite3 jaxa_color.mbtiles
sqlite> select * from metadata where name='format';
format|png

I assume the last line returns nothing in your case, in which case you can add it in with something like INSERT INTO metadata (name,value) VALUES('format','png'); (where 'png' is should be your real image type)

acalcutt commented 4 months ago

As far as i can see from he documentation there is no way to change the format of a data file other than editing the file. You could likely still make a style and specify the data as a raster and it would probably work, despite showing wrong under data. but to fix it I think you need to do the sqlite commands I mentioned.

veitbjarsch commented 4 months ago

@acalcutt thanks for the help. This was indeed the problem.