User:Ff5722/Using Sentinel-2 imagery

From OpenStreetMap Wiki
Jump to navigation Jump to search

Sentinel-2 satellite data is licenced suitably to be used as background for tracing or any other purpose for OSM (licence). The best resolution available is 10 m, this is enough to trace major roads, rivers, lakes, railways etc. Pretty much the entire world is covered, and imagery is very recent (several captures per month, as recent as last week), however it can be covered in clouds, so in some cases, it is needed to use imagery of a few months old.

Preview imagery

The data is not available in a viewable image format for free accounts, therefore you need to process it first. However, Sentinel-hub offers a service to preview the tiles. Note that WMS service is only available for paid accounts, and do not trace directly from their website because their licence is CC 4.0, which is not allowed for OSM use. You can use it as an aid to view which area needs updating, or which date has good cloudless capture.

Rendering images

You can either use QGIS or ESA's own software to render the data. I recommend QGIS as it is much more versatile.

Using QGIS

  1. Install QGIS from
  2. Download data from You need to register a (free) account to download data. Login with your account, select an area on the map (try to keep the selected area small, it's best to download one tile at once) and search. Filter the results to show only Sentinel-2 captures, set cloud cover limits in the filter 'Cloud Cover % (e.g.[0 TO 9.4])', I recommend cloud cover [0 TO 20]. Download the zip package (usually around 1 GB).
  3. In QGIS, navigate to your downloaded package and expand the folder
  4. Add the files with the raster icon and file name ending on B02_10m.jp2, B03_10m.jp2 and B04_10m.jp2 to the QGIS project (see image)
    Add the layers to QGIS project
  5. In the menu bar, go to Raster > Miscellaneous > Build virtual raster
  6. In the build virtual raster window, click the three dots next to Choose input layers. Select the 3 layers you just added. Select 'Run', it should only take a second to complete.
  7. Right clicking on the 'Virtual' layer, select properties, and adjust the Min-Max limits under 'Symbology' > 'Band Rendering'. You can adjust each color manually for the best color reproduction. Easier is to expand the 'Min / Max Value Settings', select 'Cumulative count cut' and adjust those values. For a cloudless image without snow, you can set the maximum cutoff pretty high (e.g. 99.7%) to get good detail.
  8. Save as GeoTIFF or directly render to tiles

Tutorial video

Using ESA SNAP software

  1. Download SNAP and the Sentinel-2 toolbox
  2. Download data from You need to register a (free) account to download data. Login with your account, select an area on the map (try to keep the selected area small, it's best to download one tile at once) and search. The results with the green tag S2A MSI are the ones you will want. It's recommended to filter the results to show only Sentinel-2 captures, and sort by cloud cover. Download the zip package (usually around 700 MB).
  3. Process data in SNAP (tutorial). It's recommended to place the downloaded granule on an SSD if available, to speed up the process (lots of R/W operations). Unzip the compressed folder, and open the XML file in the top level (e.g. MTD_MSIL1C.xml). Once it's visible in the left pane, right-click to open RGB view, the three colour bands will be pre-selected. Simply click OK and wait for the RGB image to be generated.Use the colour manipulation tool in the bottom left pane to ensure good contrast of roads etc.
  4. Export processed image from SNAP. Right-click on the image, click export. Choose 'export full scene' and 'full resolution' and for filetype geoTIFF. It will take several minutes to finish on most computers.

Using satellite image as background

To trace from the image, it has to be added as a background layer in your favourite OSM editor. The easiest way is through Mapbox Studio, but if you regularly need to process imagery, setting up a local tileserver will save you time in the long run.

Mapbox Studio

If you have only a few tiles to use, this is the most convenient method. You can also overlay your different tilesets and choose a background layer for empty areas. The downside is that it requires uploading a 500 MB tile to Mapbox, which may take a while depending on your internet connection. The free plan has a limited bandwidth and storage size as well (maximum of about 10 Sentinel-2 tilesets).

  1. Sign up for Mapbox Studio here [1]
  2. Log in and go to tilesets > New tileset > Upload > upload your geoTIFF
  3. Then go to Styles > new style > pick any ('satellite', 'empty', or 'black' work best).
  4. Go to your new style, then go to > edit > new layer > under 'source' select tileset > select your uploaded tileset. I recommend to give it a descriptive name
  5. Go back to your style, on the right click Share & use, go to the 'use' tab, and select 'third party'. For JOSM, copy the WMTS URL. For iD, use the CARTO URL, but you need to change one thing, which is remove the '@2x' from your URL. For example:{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiaGluZGJhZXIiL

Thanks to 7thgrade for guiding me through the processing method

Local tileserver

Main article: User:Ff5722/Using local tilesets as background layer

If you have half an hour to set it up, I recommend this method as it is much more convenient in the long run.

JOSM ImportImage plugin

The ImportImage plugin provides a simple method to use images as a background. However, if you try to use an entire Sentinel-2 granule as a background using this plugin, JOSM's performance will grind to a halt. For smaller areas, this may be a good option though.

To start, in QGIS, use the clipper tool (Raster>Extraction>Clip Raster by Extent) to clip a small area. Select the '...' next to 'Clipping extent' and 'Select Extent on Canvas', then Run. In the Layers panel, right click the clipped layer and Export as Rendered GeoTIFF. Now go to Raster>Extract Projection> and export the projection file for the clipped layer you just saved. Save the projection in the same location and with the same name.

In JOSM, you can now go to Imagery>Import Image to use it.


You can set up a WMS server at for free.

Getting processed imagery

Should you want to trace a specific region, but you can't be bothered to process the imagery yourself, then send me a message and I will process it for you when I have time and send you the link to use as background layer.