I have question about raster tiles generated from geoserver.

Is possible provide nice tiles without calling other external service like osm or google maps?

I need tiles looks like this : https://a.tile.openstreetmap.org/7/63/42.png

How can I download tiles and provide it directly from my server?

Could I use osm2vectortiles or some other stuff and how?

For database I use postgis database created by osm2pgsql. This db will be provide me some route, and I need create base layer for this route.

If I use sld styles how can I style surrounding of my selected route?

For example: I select some route and pg return info about route ... so I can style route but not surrounding.

How can I do that?

I googleing and found possible solutions:
A: download tiles for all zoom levels and provide it as base layer
B: download sld styles, and style result

for me is better choice solution A, becouse I do know how do that what I describe in update 1.

Can you give me some hint to solution A?

  • 2
    I would recommend you follow the excellent tutorial published on the geoserver blog in 2009. It may be a bit outdated in places, but will give you an opportunity to refine your question a bit more to specific problems.
    – Phil G
    Nov 16, 2016 at 13:53
  • I checking this, but links for SLD e.g are dead :[
    – Aligator
    Nov 16, 2016 at 13:57
  • GeoWebCache is creating a different directory tree and direct access to zoom/x/y.png does not work. I fear that mapping png files in the GWC tree to Google tile names is not trivial. The subdirectories in the GWC tree are planned so that there are never very many files in the same directory. For offline use you should probably take some code from the GWC project.
    – user30184
    Nov 16, 2016 at 14:54
  • I update my question, check pls
    – Aligator
    Nov 16, 2016 at 14:59
  • Option A will require a lot of tiles and a lot of time to download them wiki.openstreetmap.org/wiki/Tile_disk_usage unless you only need a very small area, or very coarse tile scale. Render your own using geoserver or mapnik.
    – BradHards
    Jun 27, 2017 at 3:53

3 Answers 3


As you're hinting that downloading tiles for all zoom levels and providing them as static base layers would be a workable solution I would recommend you take a look at MapBox's TileMill.

TileMill allows you to import the relevant area of OpenStreetmap (Vector) data, style it and then export it into various formats. Crucially there is a geoserver MBTiles extension which makes the import of TileMill output very easy.

I've personally only come across TileMill recently and have not had a chance to test it beyond a quick play, but it looks very promising.

Alternatively you could style the OSM vectordata using QGIS and export using one of the methods mentioned in a previous question on "How to generate tiles with QGIS".

Finally in terms of loading the raster tiles into geoserver you could go down the database storage route or use a flat file structure. For the latter there is a previous question on "Prepare raster data for WMS using geoserver" - GIS-Jonathan's answer provides the detail. On the database side the question on "How to publish postgis rasters in geoserver" is a great starting point.


To expand on Phil G's answer, if you were looking to serve your own tiles from a private server, take a look at the tutorial provided by OSM: https://switch2osm.org/serving-tiles/manually-building-a-tile-server-14-04/

You'll be using Mapnik to render raster images from vector data and spatial queries.

  • Hi, this is tutorial on switch2osm is for linux and I develop on windows :/ ... so I trying install mapnik but unsuccessful becouse I do not know what could I do (I never work with cmd before) Can you help me install it ?
    – Aligator
    Nov 17, 2016 at 15:19
  • @Aligator (based my own research for personal projects) it's not possible to render OSM based tiles from Windows due to dependency conflicts and the way that Windows integrates into the kernel. Keep in mind this is to serve tiles, if you already had a tileset of pre-rendered rasters you won't need mapnik at all, just a clever way of selecting which tile.png you want. Nov 17, 2016 at 15:21
  • So can you help me with the best solution for my stuff? I have task to create server which will be provide base map without calling external services. Base map could be store in geoserver, or other local server ... Do you know any solution which will be compatible with windows? And second task is create route service but this is other thing, I only saying for your better advice
    – Aligator
    Nov 17, 2016 at 15:28
  • Not with Windows, no sorry. There may be solutions, most (if not all) of my time developing outside of WPF is spent on a Unix machine so I only ever look for Unix based solutions. If you do need help with using Mapnik on linux, fire me a message. Nov 17, 2016 at 15:29

geoserver with geowebcache and MBTILES or gpkg (geopackage) extension will meet your needs for offline mapping. Another option use approach to take your WMS and make mbtiles or geopackage.

Not the answer you're looking for? Browse other questions tagged or ask your own question.