Geographic projection missing in output


I run sen2cor via command line. When I try to open the output granules individually (e.g: in QGis) the data is missing the information about its projection. Does anyone else have the same issue? Any ideas?



i think every person has the same problem. I’m using Snap and Export all image or single Granule using Beam-Dimap. Program creates two files (one snap shorcut and second folder when you can find files ind img format). Next you can merg this file in QGIS eg.



Thank you. Good to know I’m not the only one :slight_smile:

My aim is to process the data via command line with as little user interaction as possible (aiming for a more or less automatic processing chain), going via Snap isn’t working out in that regard.


Should be working fine with command line.

1 Like

Thank you.
I’m using a similar method for “manual” georeferencing I found on stackoverflow, I was just wondering why sen2cor output does not provide it automatically.

Here’s the code I use:

def readFile(filename):
    filehandle = gdal.Open(filename)
    band1 = filehandle.GetRasterBand(1)
    geotransform = filehandle.GetGeoTransform()
    geoproj = filehandle.GetProjection()
    band1data = band1.ReadAsArray()
    xsize = filehandle.RasterXSize
    ysize = filehandle.RasterYSize
    return xsize,ysize,geotransform,geoproj,band1data    

def writeFile(filename,geotransform,geoprojection,data):
    (x,y) = data.shape
    format = "GTiff"
    driver = gdal.GetDriverByName(format)
    dst_datatype = 2 #gdal.GDT_Byte
    dst_ds = driver.Create(filename,y,x,1,dst_datatype)
    return 1

(x,y,transform,proj,data) = readFile(filenameIn)


Has anybody tried to use the script in order to georeference L2A images from L1C with the new version of Sen2Cor 2.2.1? With the older version it worked perfectly but now it seems to not correct the projection.
Taking into account that this DEM problem is not going to be fixed in the close future, has anybody know how to solve this issue?
I would really appreciate any clue.

Thanks in advance.

I am having the same problem. Was it working ok with 2.2.0?

I have not updated sen2cor since I expected further issues with this software; is still working for me.

So I managed to get working.

I built my own version of GDAL version 2.1 including OpenJpeg.

Note of interest GDAL v2.1 has a Sentinel 2 driver which has been excellent on L1C data. Will try on L2A soon.

1 Like

can you elaborate a bit and maybe post the code you altered?

I am not an expert so please don’t take these instructions as gospel.

My process is a bit of a round about way of doing it but essentially I run all my projects on remote virtual machines due to internet connection limitations locally.

One VM with Anaconda & sen2cor and the other with GDAL 2.1:
On the VM with GDAL 2.1:

  1. Download source and build OpenJPEG (
  2. Download source and build GDAL 2.1 (, with this tag:
    ./configure --with-openjpeg=/usr/local --with-python=yes
    sudo make install
  3. Mount to drive to the Anaconda/sen2cor VM to where my L1C & L2A files with sshfs
  4. Create script so I can run from Anaconda vm environment via ssh

This is, I imagine, is not the neatest way to do this and would say it could be achieved with a python virtual environment on the same machine as Anaconda, but I could not get GDAL working that way despite the online instructions…

I am also unsure as to why the GDAL included with Anaconda does not support reading and writing JPEG2000 files since it would need to for processing with sen2cor. Anyway, GDAL 2.1 is required for trying out the new GDAL Sentinel 2 driver so I am happy with my setup for now.

1 Like

@Jan @Olivier @marpet @Fabrizio_Ramoino

Can any of your please chime in on this issue!?
Having TOC Data with no projection makes the whole tool pretty much useless and workarounds like they are posted here can’t really be a long term solution.
I’m at a loss why solving this wasn’t high on the priority list for the recent update, the update even deteriorated the bug since the workaround won’t work anymore.



I have managed to use in another computer but I agree with Christian in the sense of this issue must be resolve quickly in order to make this tool feasible, at least not losing the DEM information from L1C to L2A. I have been in the ESA Living Planet Symposium last May and we were looking forward for a solution on this issue without any response.
Hope the summer Sen2Cor update will fix all these stucking problems!

or you can use this little python script.
gdal python module is required (use easy_install if needed).

get it there

1 Like

does it work with sen2cor 2.2.1 ?

Yep !
It simply transpose georef and projection from L1C to L2A

Dear all,
I’m a complete newbie in the matter. I’ve been following all instructions and gathering all technical data (not easy) to understand Sentinel-2 products and to correct the images to get BOA reflectances. I was happy when I got everything working until I realized L2A jp2 bands were not georeferenced. I found this thread in the forum but now I need help from you on how to apply the nmatton script. I’m sorry but I have no idea on how or where to start… I guess I need to install Python and GDAL for Python in my W8.1 machine but after reading the thread with problems in Sen2cor installations I’m affraid that I could damage mine which is currently working.

Could any of you please help me with some directions on what are the steps to run the nmatton script from zero. I would really appreciate that.

And just for some additional discussion. Is that a bug in Sen2cor or is there anything to be done to georeference the L2A output bands within SNAP 3.0?


If you can run sen2cor python ist already installed on your machine.
I have not run @nmatton script but from looking at the code your should be able to run in in a CMD window with python path/to/ -i folder
where folder = the folder containing S2 SAFE folders (OPER and USER)

I still run sen2cor 2.0.6 because I have a working setup and 2.2.1 didn’t improve on this critical issue. Here works. Usage is: python projFile.jp2 unprojFile.jp2
You have to loop through the images, so if you have no coding experience your best choice is to use nmattons script which takes the whole folder as input.

Is that a bug in Sen2cor or is there anything to be done to georeference the L2A output bands within SNAP 3.0?

I doubt SNAP is capable of handling this issue. Unfortunately we don’t have any information about solutions or progress because the involved personel @Jan @Olivier @marpet @Fabrizio_Ramoino remain silent about this.


I’m really an L1C kind of guy, so I’ll flag it to my colleagues who have expertise in L2A.



1 Like


I tried your script (thanks for making it available!) and i run into the same issue I get stuck with using gdal.
Both (python) scripts can’t open the .jp2 files produced by sen2cor 2.2.1. Did you have this problem as well, if yes how did you solve it?