SentinelHub process request problem

Hello, currently I am using sentinel hub’s process request for fetching all bands and using them in my API.
The request that I am sending is the following:

    # Variables for the request
    crs = "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
    query = "?useCache=true&retries=5"
    url = "https://services.sentinel-hub.com/api/v1/process" + query
    # this returns the width and the height of the bbox
    w_h = self.get_width_height(geometry)
    width = int(w_h[0])
    height = int(w_h[1])

    # Request
    response = requests.post(
        url,
        headers={"Authorization": "Bearer {}".format(token)},
        json={
            "input": {
                "bounds": {
                    "properties": {
                        "crs": crs
                    },
                    "geometry": geometry,
                },
                "data": [
                    {
                        "type": "S2L2A",
                        "dataFilter": {
                            "timeRange":
                            {
                                "from": start,
                                "to": end
                            }
                        },
                    }
                ],
            },
            "output": {
                "width": width,
                "height": height,
                "responses": [
                    {
                        "identifier": "default",
                        "format": {
                            "type": "image/tiff"
                        }
                    }
                ],
            },
            "evalscript": """
            //VERSION=3
            function setup() {
                return {
                    input: [{
                        bands: ["B01", "B02", "B03", "B04", \
                        "B05", "B06", "B07", "B08", "B8A", \
                        "B09", "B11", "B12"],
                        units: "DN" }],
                    output: {
                        id: "default",
                        bands: 12,
                        sampleType: SampleType.UINT16
                    }
                }
            }
            function evaluatePixel(sample) {
                return [ sample.B01, sample.B02, sample.B03, \
                sample.B04, sample.B05, sample.B06, sample.B07, \
                sample.B08, sample.B8A, sample.B09, \
                sample.B11, sample.B12]
            }
            """,
        },
    )
   return response.content

The problem here is, in some days when I use the geojson of the area that I want to fetch the data, it works fine. But some days, the sentinel api requires the reversed geojson (replace lats with lngs and lngs with lats) in order to work properly, if i do not reverse the geojson it gives me data of a different area.

For example:


I chose this area, but sentinel gives me a reverse of it like the following:
Screen Shot 2020-03-31 at 5.59.56 PM
And some days it works fine.

I would be thankful if you helped me.
Best regards

Hi @tarla,
this sounds quite strange.
We have not heard of any similar case.
Can you post an actual request, which returns the wrong result?

This is the json payload that I am requesting to https://services.sentinel-hub.com/api/v1/process?useCache=true&retries=5

{'input': {'bounds': {'properties': {'crs': 'http://www.opengis.net/def/crs/OGC/1.3/CRS84'}, 'geometry': {'type': 'Polygon', 'coordinates': [[[37.153390462540635, 38.927983045578], [37.15326219573836, 38.92972111701965], [37.15458760886921, 38.92908811569214], [37.15474152630773, 38.93030047416687], [37.15213343849594, 38.93213510513306], [37.15274057516746, 38.93325090408325], [37.15436528312711, 38.932210206985474], [37.156357640494456, 38.93113732337952], [37.156357640494456, 38.92930269241333], [37.155759083712454, 38.92936706542969], [37.15445079310527, 38.92761826515198], [37.153390462540635, 38.927983045578]]]}}, 'data': [{'type': 'S2L2A', 'dataFilter': {'timeRange': {'from': '2020-03-20T00:00:00Z', 'to': '2020-03-22T00:00:00Z'}}}]}, 'output': {'width': 42, 'height': 56, 'responses': [{'identifier': 'default', 'format': {'type': 'image/tiff'}}]}, 'evalscript': '\n //VERSION=3\n function setup() {\n return {\n input: [{\n bands: ["B01", "B02", "B03", "B04", "B05", "B06", "B07", "B08", "B8A", "B09", "B11", "B12"],\n units: "DN" }],\n output: {\n id: "default",\n bands: 12,\n sampleType: SampleType.UINT16\n }\n }\n }\n function evaluatePixel(sample) {\n return [ sample.B01, sample.B02, sample.B03, sample.B04, sample.B05, sample.B06, sample.B07, sample.B08, sample.B8A, sample.B09, sample.B11, sample.B12]\n }\n '}

The last part is the evalscript. In the headers I just add the auth token. I do not think there is a problem in the request but in the way sentinel handles it. It reverses the geojson latitude and longitudes

If I put your coordiantes in geojson.io, I get the same shape as you get from Sentinel Hub.
So I’d guess that it might be a problem in your geojson?

The problem was that Sentinel reverses the geojson coordinates (replaces lats with lons and vice versa). I fixed it by first checking if my coordinates are available in the FeatureCollection of the sentinel. As you can see the area in the first picture is not the same as the area sentinel gets, so it mean the geojson is being reversed. I hope i could make myself clear :slight_smile:

It seems to me that you have fixed the problem?

If not, can you also send the example of the request for the first picture?

Hello, yes I fixed the problem. the bbox parameter was wrong. BBOX and SRSNAME parameters were not compatible