rastergeotoolsgeotiffgeotrellis

Java or scala, GeoTools or GeoTrellis, how to convert sentinel 2 data to Multiband geotif


I am trying to process Sentinel 2 data from (example)

http://sentinel-s2-l1c.s3-website.eu-central-1.amazonaws.com/#tiles/10/S/EG/2016/10/12/0/

The jp2 files are not georeferenced, and I need to put all the jp2 files as bands in a geotif. I have googled aplenty and find no way to do this in Java or Scala.

I am pretty familiar with Geotools, i've done a lot of geotif processing with geotools, but I can't figure out how to

a. Make a geotif raster out of a jp2 file (given coords for the envelope), and

b. take those and make a multiband geotif out of them

I am decent with Scala, so I've looked at geotrellis, but don't see a solution with that either.

Does anyone know how to make geotifs out of JP2 files (given a polygon) and then make a multiband geotif?

thanks


Solution

  • I've never tried this, but, I would break the problem down to:

    1. Import JP2 image
    2. GeoReference the image
    3. For each band in the image data, convert to GeoTiff

    Step 1 will need you to make sure that you have the JP2K plugin, that page also gives some sample code showing how to use it.

    Step 2 should just be a case of building a GridCoverage using a GridCoverageFactory - see the user guide for an example (I am assuming you know where the bounds of the grid are and it's projection etc).

    Step 3 is a simple CoverageWriter, there is an example here.