Processing Sentinel imagery with GIMP

Sentinel imagery can be thought of as Europe’s equivalent of Landsat imagery. It is freely available just like Landsat imagery, but higher resolution. Today we are having a look at how to process it in order to view it in Google Earth with the help of GIMP.

Before we begin, if you intend to work with Sentinel imagery a lot, then first have a look at GeoSage’s Spectral Transformer for Sentinel-2 Imagery, as that makes the process extremely easy and adds some additional features that we simply cannot accomplish with GIMP. The only downside is it is not a free product.

In addition, the European Space Agency (ESA), provides a free tool called SNAP for processing Sentinel imagery, but we have not yet managed to figure out how to use it to get imagery into Google Earth.

Obtaining the imagery
The best way we have found for getting Sentinel imagery is from Amazon Web Services (AWS). The first step is to find out what the tile code is for the area you are interested in. To do this, download this KML file, which shows the tiles and tile codes. In our case we were interested in a landslide that occurred near Glacier Bay, Alaska on 28th June, 2016. This turned out to be tile 08VLL. The next step is to go to this page on AWS and find the data for your chosen tile. So in our case, select ‘8’ which represents the ’08’ in the tile name, next select ‘V’ and finally ‘LL’. Then you choose the date you are interested in, in year – month – day order. Imagery is captured about once a week, but it can vary by location. In our case, the only image so far captured after the event of interest was captured on July 11th, 2016. Finally click on the ‘0’ as there is typically only one image for a given day. You should now see a list of files available, and for a standard colour image you only need B02.jp2, B03.jp2 and B04.jp2. Download them by clicking on the links. Each one is about 85 MB.

The imagery can also be obtained here, which provides the imagery in a format suitable for use with SNAP, but the downloads are typically 5 to 6 GB as they include a large area and all the colour bands.

Converting to jpg
The Sentinel imagery is provided in a format known as JPEG 2000 with file extension “.jp2”. Although the JPEG 2000 standard was created in 2000, it hasn’t been very popular and not many programs support it. We believe GIMP has partial support, but it was not able to open the Sentinel imagery. So, we used a free image viewing program called Irfanview to do the conversion. Simply open the files in Irfanview then save them again as “.jpg”. Other free converters exist such as OpenJPEG and ImageMagick, both of which are command line converters.

Combining the colour bands
The next step is to open all three images in GIMP – open one first, then add the others as layers by dragging them into the ‘layers’ pane. To combine them into a single image, select Colors->Components->Compose. Choose RGB as the colour model and select B04 as the red channel, B03 as the green channel and B02 as the blue channel. This will open a new GIMP window with the three layers combined into a single image. It may still look a bit colourless at this stage. Now select Colors->Levels. In the popup window click the ‘auto’ button, then click ‘OK’. The colours should now look a lot better.

At this point our image looked like this:

Glacier Bay, Alaska, Copernicus Sentinel data, 2016.

Note that the image doesn’t fill the whole square and it is actually only part of a much larger image. However, even this piece is larger than we actually want. So, we cropped the image to the area we were interested in, then exported it as a “.jpg”.

Importing into Google Earth
When you use GeoSage’s Spectral Transformer for Sentinel-2 Imagery, as mentioned earlier, the resulting image contains the geographical coordinates and it can simply be drag and dropped into Google Earth Pro. However, our method above does not include any geolocation information, so it must be manually positioned. Open Google Earth, navigate to the approximate location the image was captured then add an image overlay. In the image overlay properties select the file previously created with GIMP. Now adjust the transparency slider (found just below where you selected the image) to about half way, so you can see both the image you are adding and the Google Earth imagery behind it. The default settings allow you to rotate and adjust the size of the image overlay, but force it to remain a rectangle. However, our Sentinel image is typically not exactly rectangular, so go to the ‘location’ tab in the overlay’s properties window and click ‘Convert to LatLngQuad’. This changes the way you adjust the overlay so that you can now move each corner individually. It can be a little difficult to get it just right, but patience usually pays off in the end. Moving each corner adjusts the whole image and puts out of alignment parts that had already been aligned. You need to look for easily recognisable features as close as possible to each corner then match up the overlay with the Google Earth imagery at each corner in turn and repeat several times until they all match. Once you are done positioning it, put the transparency slider back to the right, so that the overlay is no-longer see-through.

Once aligned, this is what our image looked like in Google Earth:


Glacier Bay, Alaska, Copernicus Sentinel data, 2016.

Zooming in to the location of the Landslide:


Landslide near Glacier Bay, Alaska, Copernicus Sentinel data, 2016.

We can also use Google Earth’s measuring tools to find that the area affect by the landslide is about 10 km in length.

To see the above image in Google Earth download this KML file. To get an idea of the size of the event, look at the northern edge of the overlay. There are two cruise ships visible, one in the Google Earth imagery and one in the Sentinel image. They look tiny in comparison to the landslide. If the landslide had gone into the water it could have caused a catastrophic tsunami.

[ Update: Also see this post for more on processing sentinel imagery. ]

About Timothy Whitehead

Timothy has been using Google Earth since 2004 when it was still called Keyhole before it was renamed Google Earth in 2005 and has been a huge fan ever since. He is a programmer working for Red Wing Aerobatx and lives in Cape Town, South Africa.






PLEASE NOTE: Google Earth Blog is no longer writing regular posts. As a result, we are not accepting new comments or questions about Google Earth. If you have a question, use the official Google Earth and Maps Forums or the Google Earth Community Forums.

Comments

  1. Timothy… is there a way of obtaining the geo coordinates encoded into the sentinel images which can then be used (either by manually encoding back into the .jpg file OR by aligning corners to manually placed placemarks in GE Pro?) Just even knowing what the corner coordinates are would be helpful for many.

    • Timothy Whitehead says:

      If you download metadata.xml from AWS when downloading the tile, it contains the Geo info.

      • Timothy Whitehead says:

        Correction: I don’t think the coordinates are included in metadata.xml. They can however be obtained from the tile KML.

  2. Add: I suppose the tile info would be the location of the geo info but it’s interpretation still eludes me.

  3. Interesting experience trying this technique to use the data. Here is my quick overview of the experience. The creators of all the dependency items don’t make it easy to download and integrate all this stuff but it is doable. (in fact GIMP changed completely from one day to the next due to release of new version).

    Download of data from sentinal is easy, albeit non-intuitive and cumbersome. Always taking the latest entry makes it easier but there’s no way to know the time of photography before downloading so my photos were very dark. Gimp allowed a levels color filter that did great except going too light would (obviously) blow out the light colors.

    The “tileInfo.json” file is the one which contains geo information – but in UTM format so you’ll need to “option” change your GE pro to use those settings – then it’s a lot of cut and pasting. Once you get it into GE count on it changing all your entries back to decimal (perhaps a bug?) so no going back and comparing once it’s done that. Also the JSON file has several entries with the coordinates each a small number different than the other so I had no clue which one to use; however, as it turns out, GE seems to be “rounding” all over the place at those high of numbers so all the placemarks are pretty much on top of each other for the four corners.

    Plus, apparently the listing for “origin” is not the center as I had supposed it would be but the redundant upper left corner. Additionally I found that there is a fifth coordinate which is basically a repeat of the first coordinate.

    Once all the work was done for the 3 color files plus placement (perhaps 3 hours for me) I found that the quality was only acceptable at high altitudes and nowhere near what is needed to zoom in on an address. SO, thinking I had “dummied down” the photo too far trying to ease off the 150 MB file size a bit, I decided to go for broke and re-do the whole process using maximum file sizes.

    It went a bit faster the second time, but not much, and the final .jpg was 155 MB! I did not want to crop the file because I still wanted to try and use the given corner coordinates for placement.

    Finally, this second attempt did make it through GE (I was worried it wouldn’t) but was no better in quality than the first 50 MB attempt!? Apparently, GE pro “dummy down’s” the quality itself no matter what you give it.

    I’m too tired to try it yet again; but, perhaps if I had cropped the image dramatically myself GE wouldn’t have been so heavy handed in it’s own limitation and the resulting overlay would have been of higher resolution. It would have been nice to find a ready source for more current images but this doesn’t seem to be it – at least as far as I can tell – until (if) someone can automate the process a bit more.

    • Timothy Whitehead says:

      I will do a post shortly to help with the coordinates. Regarding resolution, the sentinel imagery is 10 m per pixel which is better than Landsat but nowhere near as good as DigitalGlobe imagery or aerial imagery. It is still useful for current imagery of large scale events such as fires, some tornadoes, volcanoes.

      • our replies crossed in the typing – agree thanks, and will await the help with coordinates – that’s always been my most difficult task and why I have rarely used it, just too difficult to get right for me.

    • OCD got the best of me and I did try to crop – in fact down to 20 meg from 159 meg. No difference – perhaps it’s not GE rounding at all – and the resolution of the satellite image. Either way – not an adequate more current alternative for the great resolution of GEs current satellite image at even small sizes.



PLEASE NOTE: Google Earth Blog is no longer writing regular posts. As a result, we are not accepting new comments or questions about Google Earth. If you have a question, use the official Google Earth and Maps Forums or the Google Earth Community Forums.