[GIS] How to get started webmapping with xyz-tiles and Geoserver

geoservertilemilltilesweb-mapping

I´m starting to explore the possibilities of web based map presentation. Therefor I have a basic question in understanding. After reading a bunch of tutorials, could a workflow work like this?

  1. Style a map (osm-bright) with tilemill
  2. export styled map in mbtiles format
  3. convert mbtiles format with mbutil to xyz-tiles
  4. use geoserver to create a wms with these generated tiles (is geoserver able to serve tiles or do I need another component like a tile server?)
  5. create a viewer with openlayers which shows my styled map tiles

Best Answer

If you create xyz tiles with mbutil, you don't need GeoServer. Mapping libraries like OpenLayers and Leaflet can read the image tiles directly from the tile folder mbutil creates.

For example, you create tiles in a folder called 'mytiles' and you place that folder in the root directory of your web server. The URL you pass to your mapping library to create the tile layer would be:

http://your.server.com/mytiles/{z}/{x}/{y}.png

For OpenLayers, I believe the code to initialize a tile layer is:

new ol.layer.Tile({
  source: new ol.source.XYZ({
    url: http://your.server.com/mytiles/{z}/{x}/{y}.png'
  })