Access DEM SRTM 30 using API request

Hello,

I’m trying to access the DEM SRTM 30 dataset.
I have read your documentation about datasets here and I;m not sure if you provide SRTM dataset or only layer that is based on SRTM layer.
My question is if it is possible to access this specific layer and if yes how.
I have tried to do it like this but that gave me 400 error for bad request:

evalscript = """
//VERSION=3

function setup() {
  return {
    input: ["SRTM30"],
    output: { bands: 1,sampleType:"FLOAT32"}
  };
}

function evaluatePixel(samples) {
  return ["SRTM30"];
}
"""

# Set coords in WGS84
coords = [17.77777822222222,-18.999999777777777,17.833333777777778,-18.94444422222222]

# Set resolution
resolution = 10

# Make bbox and size
bbox = BBox(bbox=coords, crs=CRS.WGS84)
size = bbox_to_dimensions(bbox, resolution=resolution)

date=('2020-01-01','2020-01-31')
request = SentinelHubRequest(
    evalscript=evalscript,
    input_data=[
        SentinelHubRequest.input_data(
            data_collection=DataCollection.DEM,          
            time_interval=date,          
        ),
    ],
    responses=[
    SentinelHubRequest.output_response('default', MimeType.TIFF)
    ],
    bbox=bbox,
    size=size,
    config=config
)

response = request.get_data()
print(f"Shape of returned images for {date} = {response[0].shape[0:2]}")
print(f"Number of bands = {response[0].shape[-1]}")

img=response[0]

plt.imshow(img[:,:,0],cmap="Greys")
plt.show()
    

400 Client Error: Bad Request for url: https://services.sentinel-hub.com/api/v1/process
Server response: “{“error”:{“status”:400,“reason”:“Bad Request”,“message”:“DEM has no band SRTM30”,“code”:“RENDERER_EXCEPTION”}}”

so my specific questions are:

  1. can I access SRTM30 using sentinel hub platform?
  2. Is there any meaning for the time range when requesting elevation layer?
  3. Are there any plans to put as default the slope layer? I saw that Maxim has shared is own module for this here, but would like to ask if something changed since then and if it is in your plan/already available as layer.

Thanks :slight_smile:

Dear Reut,

we offer Mapzen DEM and Copernicus DEM. Mapzen DEM is based on SRTM 30 and also other sources, so not just SRTM 30. Copernicus DEM is based on WorldDEM that is infilled on a local basis with the following DEMs: ASTER, SRTM90, SRTM30, SRTM30plus, GMTED2010, TerraSAR-X Radargrammetric DEM, ALOS World 3D-30m. So again, not just SRTM 30.

The collection for DEM in Sentinel Hub is called DEM, and the available band you can call into your evalscripts is also called DEM. You got the error because you used SRTM30 as an input band for our DEM collection, and this band doesn’t exist. So you should change your input band to DEM, then specify the instance in the request to be either MAPZEN, which is default, COPERNICUS_30 or COPERNICUS_90. You can then visualize the DEM band in different ways. Find some evalscripts here.

In general, you can check all the details about each collection, including which bands the evalscript will take, in our documentation, where you also have request examples. For DEM, see here and here.

DEM is a raster model created based on ground elevation in meters, so it has no time range or acquisitions.
There are currently no plans to add a slope layer to Sentinel Hub.

All the best,
Monja

1 Like

Hi Monja,

thank you for your answer.
I’ll just share it what I did in order to get the DEM 30 meters -
I specificed the data collection :

evalscript = """
//VERSION=3

function setup() {
  return {
    input: ["DEM"],
    output:{
        id: "default",
        bands: 1,
        sampleType: SampleType.FLOAT32
    }
  }
}

function evaluatePixel(sample) {
  return [sample.DEM]
}
"""


request = SentinelHubRequest(
    evalscript=evalscript,
    input_data=[
        SentinelHubRequest.input_data(
            data_collection=DataCollection.DEM_COPERNICUS_30,          
         
        ),
    ],
    responses=[
    SentinelHubRequest.output_response('default', MimeType.TIFF)
    ],
    bbox=bbox,
    size=size,
    config=config
)