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”