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.

To use the imagery in an OSM editor, there are two steps:

  1. Download the raw data and render into GeoTIFF image files
  2. Serve imagery as a tileserver to your OSM editor.

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-BY-NC 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. https://apps.sentinel-hub.com/sentinel-playground/

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 https://qgis.org/en/site/forusers/download.html
  2. Download data from scihub.copernicus.eu. You need to register a (free) account to download data.
    1. Login to your account
    2. Select an area on the map (try to keep the selected area small, it's best to download one tile at once) and search. Use right mouse button to draw.
    3. 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].
    4. If the download does not work, it means the granule is not processed yet, it will also say 'offline'. You will have to add it to cart and refresh the page later. The tile will normally be available for download within one hour from the cart symbol in the search box.
    5. 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. Make sure to select 'Place each input file into a separate band'
  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 scihub.copernicus.eu. 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.

Serving imagery

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