[mapserver-users] Using MBTiles with MapServer

Carl Godkin cgodkin at gmail.com
Mon Apr 25 08:25:41 PDT 2022


Hi,

I have a working MapServer WMS server where the size of the input imagery
data is becoming a concern.

I used gdal_translate to convert our input satellite imagery files to
.mbtiles format and it's now about 20% of the size of the GeoTIFF files I
had been using before.  (The GeoTIFF files are compressed and have
overviews.)  This seems promising.

I have added a new LAYER to my .map file for the converted data but I
cannot get MapServer to display the imagery as I expected.  It's all black
(or more likely, transparent).

As a test, I converted  one of the .mbtiles files back to GeoTIFF and it
still looks fine to me so I don't think my conversion (a pretty simple
gdal_translate command line) messed it up.

I have the debug logging in MapServer set to 5 and can see the queries
coming through and no obvious errors.  For instance:

# shp2img -m mapserver.map -l "NAIP_mbtiles" -o /test.png -all_debug 5
msLoadMap(): 0.010s
msDrawMap(): rendering using outputformat named GEOTIFF (GDAL/GTiff).
msDrawMap(): WMS/WFS set-up and query, 0.000s
msDrawRasterLayerLow(NAIP_mbtiles): entering.
freeLayer(): freeing layer at 0x55d543267ac0.
msDrawMap(): Layer 2 (NAIP_mbtiles), 0.005s
msDrawMap(): Drawing Label Cache, 0.000s
msDrawMap() total time: 0.006s
msSaveImage(/test.png) total time: 0.011s
msFreeMap(): freeing map at 0x55d542ee5680.
freeLayer(): freeing layer at 0x55d543223250.
freeLayer(): freeing layer at 0x55d5432262e0.
freeLayer(): freeing layer at 0x55d54323e350.
shp2img total time: 0.026s

I using the "camptocamp" docker image for MapServer and it has this version:

# mapserv -v
MapServer version 7.6.4 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ
SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS
SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT
SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=GEOS
SUPPORTS=POINT_Z_M SUPPORTS=PBF INPUT=JPEG INPUT=POSTGIS INPUT=OGR
INPUT=GDAL INPUT=SHAPEFILE

As far as I can tell, its version of GDAL supports MBTiles.  (It's listed
among the "gdalinfo --formats" output among other evidence.)

Does anyone have any suggestions?  I can't find discussion of the .mbtiles
format in the docs except around Mapcache and Google hasn't found me
anything useful so far.

Thanks a lot,

carl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20220425/fde10266/attachment.html>


More information about the MapServer-users mailing list