Exporting Sentinel 2 Imagery

I am exporting sentinel 2 imagery as GeoTIFF. But, all the bands are being exported as a single image of 50 bands. Also, how do I know that the image has coordinates attached to it and if it has then how can I access them?

Where did you download the data?
You should always use the S2 import from the File menu.

In your title you write about exporting - please be precise so we can help.

1 Like

Oh sorry, it was typing error. My query is regarding exporting images.

why do you want them exported as GeoTiff?

I want to perform Random Forest classification in MATLAB or any other programming language. The classifier in the SNAP software is showing that bounds must be positive because while creating the vectors the coordinates are shown in Cartesian system.

You can see the projection of your data by clicking on this button:

You can try to re-project your rasters to WGS84, maybe this helps to use it in the Random Forest Classifier. Just make sure you un-check “Re-project tie-point-grids” as this takes so much time.

1 Like

I tried the method you suggested. Still I am getting the error “bound must be positive”

However, now the training polygons show lat/lon.

that is strange indeed. Could this be a bug, @junlu?

Could anyone help me with exporting images as GeoTIFF and accessing the coordinates?

you can right-click on your raster > Spatial subset from view. Then agree to coregister (like described here Resample processing time) and then select the bands for export.

The rasters are already geocoded so that should work in any way. What do you mean by “accessing the coordinates”?

When I am exporting the image as GeoTIFF and reading it in MATLAB, an imageset of 50 bands is created. There is a bit of difficulty in identifying which band corresponds to satelllite imagery. Also, I wish to create training set based on latitude and longitude. So, I must know if there is coordinate information in the image and how can I make use of it.

if you select a subset you can directly chose the rasters to export.

1 - Spatial subset from view

2 - Hit “Yes” here and say “Run” and confirm with “OK”

3 - Repeat step 1 with the new image. In the dialogue, you can select the bands for export

4 - Save the band subset as GeoTiff

6 - The new product is a GeoTiff with consists of the bands selected in step 3

2 Likes

Hi,

You could also use other tools as e.g. gdal_translate. In a linux environment, you can use it for single bands as e.g.:

path/to/products/S2A_MSIL1C_…SAFE/…/IMG_DATA$ gdal_translate input_band.jp2 output_band.tif

Then, your output band is in geo-referenced tif. I guess matlab (as you refer to) has multiple packages/modules for reading the geo-reference information in GeoTIFF.

/Trygve

1 Like