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

From OpenStreetMap Wiki
Jump to: navigation, search

Installation

This only needs to be done once.

  1. Install QGIS from https://qgis.org/en/site/forusers/download.html
  2. Install an local web server such as WampServer or XAMPP
  3. 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.
  4. 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 127.0.0.1 examplename.domain to your hosts file.
  5. 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.
  6. 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).
  7. 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. If you use QGIS3, install the Qtiles3 plugin by 'alexbruy'. If you use QGIS2, install the Qiltes plugin by Nextgis.

Usage

  1. 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.
  2. Go to Plugins > QTiles and open the QTiles window. Refer to the table below to see which settings to use.
  3. Rename the JSON file to metadata.json and place it in the same folder as the tiles. (like \tileserver\London\metadata.json)
  4. Start the local web server
  5. In JOSM, select your custom WMTS server and start tracing.
  6. If the tileset doesn't appear in the JOSM 'Select WMTS layer' window, you need to delete the WMTS cache. This is due to the way JOSM handles imagery. To enable the new layer, 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.
Option Recommended setting
Tileset name Name of area in tileset, cannot contain non-Latin script
Output Directory: Should be your tileserver top level folder e.g. 'C:/wamp64/www/tileserver'
Extent Choose 'layer extent' in most cases. Choose 'full extent' if you want to render multiple images as one tileset, for example connecting satellite imagery.
Zoom Minimum zoom: 0
Maximum zoom: 15 (or higher if using high-res images)
Tile width
Tile height
Format
Background transparency
Quality
Leave at default. You can choose to render tiles in JPG if storage is a concern.
Make lines less jagged Off, unnecessary for imagery
Use TMS convention Leave at default (off)
Render tiles outside extents I recommend turning this on. Renders whitespace around your data, makes it easy to find on the map, but will overlap if you use other layers.
Write .json metadata Turn on (important)
Write overview image file Leave at default (off)