# What's the best way to host map tiles?

I'm interested in generating some open-source maps, with possibly world-wide coverage. I know that depending on the number of zoom levels I include, the number of tiles can be very large, taking up a lot of disk space. I also don't anticipate that demand for the maps will be very large, so bandwidth isn't as much of an issue.

What's the best way to store and host map tiles, assuming that keeping costs low is more important than bandwidth?

Bonus question: what if demand goes up, and bandwidth becomes more important than lowest cost?

• If you're not wedded to tiles, you might also want to consider a jpeg2000 jpip server, as you're not expecting high usage. ESA (European Space Agency) funded the one that's used in Helioviewer : wiki.helioviewer.org/wiki/JPIP_Server – Joe Feb 27 '15 at 23:49

Take a look at what OpenStreetMap does. There's a page describing the nature of tile server disk usage. If you go up to zoom level 18 worldwide, you're talking about 91,625,968,981 tiles, which would take around 54000GB of disk space, but would mostly never be viewed.

So I'm not sure if it would ever be a sensible approach, but having said that, I heard that MapBox do pre-generate all their tiles when hosting a tile set. I think they go up to higher zoom levels just in the cities or something like this.

The approach OpenStreetMap tile servers use, is a combination of on-the-fly rendering and caching. The management of this is done with a specially written apache module called mod_tile

Either way, if you want to do things worldwide up to a high zoom level, you need something a little more complicated than a filesystem full of 256x256px PNG images. mod_tile stores files in cache as a 'meta-tiles'. MapBox uses a format called MBTiles to store all the tiles in a database file.

I mentioned MapBox a few times. If you pay them they'll render & host tiles for you. There's various other providers of tile hosting/rendering and other map services

In general you'll find the OpenStreetMap tech community have a lot of experience with this kind of thing. You can contact them in various ways. There's even a question & answer site: https://help.openstreetmap.org

Have a look at Open MapQuest. They offer the Nasa BlueMarble, Satellite and different versions of OSM for free. They only require you to attribute them and OSM, etc., and let them know if your app will exceed 4000 tiles per second.

You could set up your own Geoserver instance, Windows based or whatever (it's a self contained Java app), use mapserver as a source for base layers and then overlay your own data using OpenLayers as the client. All free.

It really depends on your audience and what functionality you need for your users and your level of technical skills in JavaScript for the OpenLayers components.

If you want to grow this to large numbers of users, then you need to consider scalability, etc. as well. Whilst not overly complicated, you will need someone who knows a lot about it to help you.

Apart from MapBox mentioned by Harry I'd also recommend having a look at CartoDB which let's you harness the power of PosGIS without the hassle of maintaining your own server (at a price).

Alternative solution is to get your own (virtual) server running and equip it with a 'geostack' of map server with database and then start building applications using map framework. Example of such solution would be GeoServer + PostGIS + OpenLayers, but each of these components could be replaced by plethora of options (MapServer, QGIS server, etc. for first part; other databases that understand spatial for second; and variety of mapping libraries).

Christopher Groskopf developed the invar library to generate tiles from a mapnik XML file. It may not be a great fit for your case, if you really want worldwide coverage, but it is a useful tool for generating tiles for a given bounding box and then efficiently uploading them to Amazon S3.

I actually no longer recommend CartoDB (which has since been renamed to CARTO), although I was once a power user and helped build the platform from its open-source days.

For maptile hosting, I'd go with MapBox at the moment.