mod_mbtiles icon indicating copy to clipboard operation
mod_mbtiles copied to clipboard

config info

Open schierkolk opened this issue 2 years ago • 9 comments

What configuration file do I update and where in the file do I update?

schierkolk avatar Mar 14 '23 23:03 schierkolk

Whatever the Apache config file is for the virtual host (site) you're deploying. For example, /etc/apache2/sites-available/my.tile.server.com.conf.

You would typically put the directives within the <Directory> unit of that file.

systemed avatar Mar 15 '23 09:03 systemed

Thank you for getting back to me. I am not getting any data to come through nor am I getting any errors. Would it be possible to get am example .conf to make sure I am doing this correctly?

schierkolk avatar Mar 15 '23 18:03 schierkolk

Mine looks like this (with paths/domains obfuscated):

<VirtualHost *:80>
    DocumentRoot "/srv/tile.my.server"

    ServerName tile.my.server

    <Directory "/srv/tile.my.server">
        allow from all
        Options None
        Require all granted

        Header set Access-Control-Allow-Origin "*"
        
        MbtilesEnabled true
        MbtilesAdd dem /data/relief/dem.mbtiles
        MbtilesAdd contours /data/relief/contours.mbtiles
        MbtilesAdd vt /data/vector_tiles/vt.mbtiles
    </Directory>
</VirtualHost>

Most of this is just standard Apache. Only the four Mbtiles lines are new.

Don't forget you need to restart Apache once you've changed a config file.

systemed avatar Mar 15 '23 18:03 systemed

Can you provide reference how you use vt/ in your web page to display map?

resiliencetheatre avatar May 13 '23 01:05 resiliencetheatre

Using the Maplibre GL JS library.

systemed avatar May 13 '23 14:05 systemed

Yes, I use same - but have hard time understanding how you define layers from mod_mbtiles ? Example would be great!

resiliencetheatre avatar May 14 '23 07:05 resiliencetheatre

Not quite sure what you mean? You don't define any layers in mod_mbtiles - it simply serves out the .mbtiles file (containing vector tiles) that you point it at. Layers are defined when you create the vector tiles with other software, such as tilemaker.

systemed avatar May 14 '23 09:05 systemed

This is how I've defined my tileserver-gl provided mbtiles for my style.json:

"sources": { "openmaptiles": { "type": "vector", "url": "http://localhost:8080/data/v3.json" } },

But somehow I am not able to get mod_mbtiles URL here to provide anything useful?

resiliencetheatre avatar May 14 '23 10:05 resiliencetheatre

mod_mbtiles just serves vector tiles from an mbtiles. Nothing else. It doesn't generate or serve tilejson documents or anything like that.

You either need to specify the location of your Apache virtual server (running mod_mbtiles) in the .json file you're pointing to above, or just put it in directly:

  "sources":{
    "openmaptiles":{
      "type":"vector",
      "tiles":["https://my.tile.server/directory/{z}/{x}/{y}.pbf"],
      "minzoom":0,
      "maxzoom":14,
      "attribution":"Base map © OpenStreetMap"
    }
  }

systemed avatar May 14 '23 17:05 systemed