Resampling with Sentinel-hub py


Is there any built-in function to resample saptial resolution?
To be more specifically,i’m interested in resampling Landsat 8 to Sentinel -2 spatial resolution.

As I haven’t found any “direct” way to do that, I thought maybe to use the data fusion tool and to return empty bands for sentinel2 as I want only landsat 8 , but not sure it can work and also wanted to know if there is any recommennded methodology.



Dear Reut,

There is no in-built function that could increase the Landsat 8 resolution. The data fusion option does enable you to sharpen Landsat imagery based on Sentinel-2, but the script uses information from both collections to deliver final results, so you won’t be getting “only” Landsat 8. Specifically, the script creates a weighted average of the three Landsat 8 true color bands, and a weighted average of Sentinel-2 true color bands, and then divides the two. In output, Landsat true color bands are then multiplied by this result.

If you’re interested in the script, copy this CURL request to the Requests Builder and click parse. You can see the script in the Evalscript panel on the left.

curl --location --request POST '' \
--header 'Authorization: Bearer <your-token-here>' \
--form 'request={
  "input": {
    "bounds": {
      "bbox": [
      "properties": {
        "crs": ""
    "data": [{
        "id": "ls8",
        "type": "L8L1C",
        "location": "AWS:us-west-2",
        "dataFilter": {
          "timeRange": {
            "from": "2020-05-21T00:00:00Z",
            "to": "2020-05-22T00:00:00Z"
          "mosaickingOrder": "leastCC"
        "id": "l2a",
        "type": "S2L2A",
        "location": "AWS:eu-central-1",
        "dataFilter": {
          "timeRange": {
            "from": "2020-05-22T00:00:00Z",
            "to": "2020-05-23T00:00:00Z"
          "mosaickingOrder": "leastCC"
  "output": {
    "width": 1024,
    "height": 1024
}' \
--form 'evalscript=//VERSION=3
function setup() {
  return {
    input: [{
        datasource: "ls8",
        bands: ["B02", "B03", "B04", "B05", "B08"],
        units: "REFLECTANCE"
        datasource: "l2a",
        bands: ["B02", "B03", "B04", "B08", "B11"],
        units: "REFLECTANCE"
    output: [{
      id: "default",
      bands: 3,
      sampleType: SampleType.AUTO
let minVal = 0.0
let maxVal = 0.4
let viz = new DefaultVisualizer(minVal, maxVal)

function evaluatePixel(samples, inputData, inputMetadata, customData, outputMetadata) {
  var sample = samples.ls8[0]
  var sample2 = samples.l2a[0]
  // Use weighted arithmetic average of S2.B02 - S2.B04 for pan-sharpening
  let sudoPanW3 = (sample.B04 + sample.B03 + sample.B02) / 3
  let s2PanR3 = (sample2.B04 + sample2.B03 + sample2.B02) / 3
  let s2ratioWR3 = s2PanR3 / sudoPanW3
  let val = [sample.B04 * s2ratioWR3, sample.B03 * s2ratioWR3, sample.B02 * s2ratioWR3]
  return {
    default: viz.processList(val)
1 Like

Hi @reutkeller,

note that if you want to technically resample the data, you can simply set the resolution in the request to 10m and the data will be resampled. By default “nearest neighbour” interpolation will be used, but you can also try bicubic or bilinear.

You might also want to check the blog post, which describes the “pan-sharpening” of the Landsat with Sentinel-2. But be aware that Sentinel-2 does not have a panchromatic band, so these methods are somehow experimental:

See section “Pan-sharpening: Sentinel-2 / Landsat-8 and Sentinel-2 / Sentinel-3”


Hi @gmilcinski,

Realize this thread is a little old, but I’m also interested in resampling. I can see that specifying 10m resolution would resample the layer to 10m resolution, but it would be very useful to also specify which grid you want to resample to. This would allow multiple layers to be available on exactly the same grid. I take it this still isn’t possible in sentinel-hub?


Hi @hughst,

the grid is defined by choosign the CRS and setting BBOX of the request.
Or are you referring to Batch reqeusts, where the grid is actually pre-defined?


Thanks @gmilcinski,

I think I can see how that would work, but does that then mean that if you specify 10m resolution for sentinel 2 with two different but overlapping BBOXs then the grid used for both requests will be different?

Cheers, Hugh

Not, if you take care that BBOX and CRS-es are compatible.

As an example - if you use UTM CRS (which is recommended for Sentinel-2, to avoid reprojection) and you define one BBOX as (-12130,5418450,41520,5447540 - the “native” UTM grid by S2) and then next BBOX as (-12135,5418455,41525,5447545 - shifted by 5 meters), then yes, grids will be different. But if the second BBOX will still be aligned with S2 (i.e. 9510,5406460,88920,5437470), grid will be the same.
Sentinel Hub API tries to fit the data in the area defined by the user, not overriding instructions.