Planet Scope black RGB image

Hi guys, I’m working with third party data API, specifically PlanetScope Tier 2 data. I followed the online tutorial. I can receive thumbnails from the following link:
https://services.sentinel-hub.com/api/v1/dataimport/collections/PLANET_SCOPE/products/{feature[‘id’]}/thumbnail
Now I’m ordering data with https://services.sentinel-hub.com/api/v1/dataimport/orders
I inserted the “collectionId” string. The obtained result has value “status created”.
After that I used the following API to recover the final image, RGB firstly then NDVI, exploiting the previous “collectionId”
https://services.sentinel-hub.com/api/v1/process
I obtained a total black image. Why? Whats wrong?

I’m using the following code, “True color” example
Examples for PlanetScope
I’m trying to recover data for a small area: about 2 ha. This is the ROi and the timestamps:
timeRange = {‘from’: ‘2023-09-01T00:00:00Z’, ‘to’: ‘2023-09-05T00:00:00Z’}
geometry = {
“type”: “Polygon”,
“coordinates”: [[[12.51388888888889, 43.1780556],[12.515277777777778, 43.1786111],[12.515277777777778,43.1788889],[12.516944444444444, 43.1788889],
[12.517222222222223, 43.1786111],[12.516666666666667, 43.1777778], [12.514722222222222, 43.1769444], [12.51388888888889, 43.1780556]]] }

Thank you in advance

After creating an order, you have to confirm it, to actually have it “running”, see the process flow.

After that, you will have to wait some time (typically minutes) for data to become available in Sentinel Hub, then you will be able to retrieve it.

Perhaps worth checking the webinar on this topic:

1 Like

ok fine!! I confirmed the ordered data, now in the SentinelHub dashboard I can read Status Done in the 3rd Party Data orders import table.

So now I can use the following link:
https://services.sentinel-hub.com/api/v1/process
where I can set collectionId from my collections table, byoc type, the time range and the ROI.

Currently the image is still total black!

What is wrong?

Hi Davide,

The image may appear very dark (almost total black) if you use the default True color script. However, if you try changing the evalscript to an NDVI visualisation like below, you should see your data:

//VERSION=3
function setup() {
  return {
    input: ["Red", "NIR", "dataMask"],
    output: { bands: 4}
  }
}
function evaluatePixel(sample) {
  var NDVI = index(sample.NIR , sample.Red)
  return valueInterpolate(NDVI,
    [0.0, 0.3, 1.0],
    [
      [1, 0, 0, sample.dataMask],
      [1, 1, 0, sample.dataMask],
      [0.1, 0.3, 0, sample.dataMask],
    ])
}

For the True Color visualisation you can try multiplying the bands by a number higher than 2.5 if you wish for the image to be brighter. e.g. 5 * sample.Red / 10000

1 Like

I’m still obtaining total black images instead of true color map, here my python code:

# RGB DATA REQUEST
def rgb():
  return '''
    function setup() {
      return {
        input: [{"bands": ["Blue", "Green", "Red"]}],
        output: { bands: 3}
      }
    }
    function evaluatePixel(sample) {
      return [5 * sample.Red / 10000,
          5 * sample.Green / 10000,
          5 * sample.Blue / 10000]
    }
    '''

if response_token:
  url = 'https://services.sentinel-hub.com/api/v1/process'
  data = {
    'input': {
        'bounds': {
            'properties': {
                'crs': 'http://www.opengis.net/def/crs/EPSG/0/32633'
            },
            'geometry': geometry,
        },
        'data': [
            {
                'type': collectionId,
                'dataFilter': {
                    'timeRange': timeRange
                    }
            }
        ]
    },
    'output': output,
    'evalscript': rgb()
  }

I cannot understan the reson why i’m getting total black images. From planet.com dashboard the area is detected correctly.

Now I also have a question, PlanetScope should have about 3 meters resolution, haven’t it? So which is the my image pixel resolution?

Hi, the following should work when using the Python Requests library.

I have included the resolution parameters in this example setting the resolution at 3m resolution for you. Please note the values are in degrees and not metres as the request is currently returning data in WGS84, whose native units of measurement are degrees and not metres.

import requests

url = "https://services.sentinel-hub.com/api/v1/process"
headers = {
  "Content-Type": "application/json",
  "Authorization": "Bearer <access_token>"
}
data = {
  "input": {
    "bounds": {
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              12.513888887654666,
              43.178055600904415
            ],
            [
              12.514722220990855,
              43.17694440090427
            ],
            [
              12.516666665441807,
              43.17777780090459
            ],
            [
              12.51722222099919,
              43.1786111009048
            ],
            [
              12.51694444322047,
              43.17888890090482
            ],
            [
              12.515277776548206,
              43.17888890090469
            ],
            [
              12.515277776548217,
              43.17861110090464
            ],
            [
              12.513888887654666,
              43.178055600904415
            ]
          ]
        ]
      }
    },
    "data": [
      {
        "dataFilter": {
          "timeRange": {
            "from": "2023-09-01T00:00:00Z",
            "to": "2023-09-09T23:59:59Z"
          }
        },
        "type": "byoc-8b63ddf2-15b5-4d51-8c6a-9a4363bfb816"
      }
    ]
  },
  "output": {
    "resx": 0.0003,
    "resy": 0.0003,
    "responses": [
      {
        "identifier": "default",
        "format": {
          "type": "image/jpeg"
        }
      }
    ]
  },
  "evalscript": "//VERSION=3\nfunction setup() {\n  return {\n    input: [\"Blue\", \"Green\", \"Red\"],\n    output: { bands: 3}\n  }\n}\nfunction evaluatePixel(sample) {\n  return [5 * sample.Red / 10000,\n          5 * sample.Green / 10000,\n          5 * sample.Blue / 10000]\n}"
}

response = requests.post(url, headers=headers, json=data)

I recommend testing your scripts in Request Builder, it’s a really neat tool that helps you understand how to build up your Sentinel Hub Requests :slight_smile:

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.