Sentinel-2 Map Data
Creating a .mbtile from a .jp2 from a Sentinel-2 Dataset for Map Tiling
Download the ESA Sentinel-2 data zip:
- Press the green "Explore Sentinel-2 Data"
- The downloaded files should be as described here
The file of interest is probably the one with TCI (True Color Image) in the filename. For me, it is a .jp2 file.
Using GDAL to do processing of the TDI .jp2:
- Install in Docker environment
This is an upgrade to the base translate command. The 8,8 increases the output resolution (smaller = more detail). Decently sure the 8,8 means 1 pixel per 8 meters in both the x and y directions. Use this to be able to zoom in more. Command takes a very long time to run.
docker run --rm -v c:\Users\User:/home ghcr.io/osgeo/gdal:ubuntu-small-latest gdal_translate -tr 8 8 /home/test1.mbtiles /home/test2.mbtiles
Mosaic
ESA Sentinel-2 Global Cloudless Mosaic
Copernicus Sentinel-2 Cloudless Mosaic Overview
Global Image Mosaic by Copernicus
Mosaics are available of the Sentinel-2 data. The last link has a tool for ordering and downloading custom shape mosaics.
Up to date documentation on S2GM
Settings
- The advanced menu gives a choice for output, I find .tif to be easier to work with.
- Use a compositing period of at least a quarter to avoid clouds.
These are the exact settings I used:
{
...
"configuration": {
"aoi": {
"type": "Polygon",
"coordinates": [
[
[
-116.76427144,
49.23679239
],
[
-116.76427144,
53.73349954
],
[
-109.51835022,
53.73349954
],
[
-109.51835022,
49.23679239
],
[
-116.76427144,
49.23679239
]
]
]
},
"srs": "WGS84",
"do_nir": false,
"date_to": "2023-09-30",
"date_from": "2023-07-01",
"cloud_mask": [
"ESA",
"LX"
],
"resolution": "10",
"output_format": "geotiff",
"temporal_resolution": "QUARTER"
},
...
}
Processing
Combine the output tifs into one mega tif. Prepare a list of .tif as described here.
docker run --rm -v c:\Users\User:/home ghcr.io/osgeo/gdal:ubuntu-small-latest gdal_merge -o /home/mosaic.tif --optfile /home/tif.txt
Translate the "mega" tif into .mbtiles
docker run --rm -v c:\Users\User:/home ghcr.io/osgeo/gdal:ubuntu-small-latest gdal_translate -co "ZOOM_LEVEL_STRATEGY=UPPER" -co "RESAMPLING=NEAREST" -of MBTILES /home/mosaic.tif /home/mosaic.mbtiles
Increase how much you can zoom in
docker run --rm -v c:\Users\User:/home ghcr.io/osgeo/gdal:ubuntu-small-latest gdal_translate -tr 5.0 5.0 /home/mosaic.mbtiles /home/mosaic-res.mbtiles
Increase how much you can zoom out docker run --rm -v c:\Users\User:/home ghcr.io/osgeo/gdal:ubuntu-small-latest gdaladdo /home/mosaic-res.mbtiles 2 4 8 16 32 64 128 256 512 1024