User:Ff5722/How to create and host tilesets from GeoTIFF images

From OpenStreetMap Wiki
Jump to: navigation, search


This only needs to be done once.

  1. Install an local web server such as WampServer or XAMPP
  2. Follow the instructions here to set up TileServer-php to be hosted on your local server (so, place the tileserver folder in the 'www' or 'htdocs' folder of Wamp or XAMPP, for example C:\wamp64\www\tileserver\tileserver.php.
  3. Redirect your localhost domain to a virtual domain. [1] This is needed because JOSM doesn't accept background imagery hosted at localhost. Add a line examplename.domain to your hosts file.
  4. Start the Apache server and go to the tileserver page (http://localhost/tileserver). Verify that your virtual domain is working, by going directly to examplename.domain/tileserver and not to localhost/tileserver.
  5. Right click the WMTS link on the right side and copy the URL. In JOSM add this URL as a WMTS server (for example http://ff5722.local/tileserver/wmts).
  6. Open QGIS and go to Plugins > Manage and install plugins. In the Plugins window, go to Settings and enable 'Show also experimental plugins'. Click reload repository. From 'All' search for the 'QTiles' plugin by NextGIS and install it.


  1. Start the Apache server
  2. Open your GeoTIFF in QGIS or open the Sentinel-2 MTDxxxxxxxxxxx.xml file. You can open Sentinel-2 zips directly in QGis, to open the image layers, click the ZIP file in the file browser panel to the left, and open the last file in the ZIP.
  3. Go to Plugins > QTiles and open the QTiles window.
  4. I recommend only generating tiles up to zoom level 15 or less for Sentinel-2 (10 meter resolution), you can dial it down if you're in a hurry. Saving the tiles to an SSD instead of to a mechanical HDD greatly speeds up the process.
  5. You don't need a very powerful CPU, I use a Pentium G4560, and generating tiles for one Sentinel-2 granule of about 50x50 km up to zoom level 16 takes around 10 minutes. Qtiles is not multithreaded though.
  6. Rename the JSON file to metadata.json and place it in the same folder as the tiles. (like \tileserver\London\metadata.json)
  7. In JOSM, select your custom WMTS server and start tracing.
  8. If the tileset doesn't appear in the JOSM 'Select WMTS layer' window, you need to delete the WMTS cache. This is due to a bug in JOSM. To do so, go to JOSM advanced preferences, and enter 'wmts' in the search field. Delete the value for 'mirror.http://yourdomain' You can also go to C:\Users\%USER%\AppData\Local\JOSM\cache and delete the cache for your tileserver.