Skip to content

Generate raster tiles

Generating raster tiles

In order to retrieve tiling information first we would need to generate tiles. One of the ways to do that is uploading data to platform using TilingWriter as in the example below.

The samples below illustrate interaction with the Platform REST API. It is also possible to generate tiles using the SDK as you can find in Generate raster tiles

Sample request to generate tiles
openapikey="<replacewithopenapikey>"

curl -L -X POST "https://api.mike-cloud-test.com/api/conversion/upload-convert" \
  -H 'Content-Type: application/json' \
  -H "dhi-open-api-key: $openapikey" \

  --data-raw "{
  \"projectId\": \"your-project-id\",
  \"uploadUrl\": \"http://sas-url-to-your-dataset\",
  \"outputDatasetData\": {
    \"name\": \"dataset-name\"
  },
  \"readerName\": \"CopernicusGlobalAnalysisForecast\",
  \"writerName\": \"TilingWriter\",
  \"writerParameters\": [
    {
      \"name\": \"Schemes\",
      \"value\": [
          {
            \"itemName\": \"Temperature\",
            \"schemeId\": \"Tiles-Temperature\",
            \"outputType\": \"WEBP\",
            \"aggregationMethod\": \"Mean\",
            \"tileWidth\": 256,
            \"tileHeight\": 256,
            \"minValue\": -2.9,
            \"maxValue\": 33,
            \"colors\": [
              \"7f03fc\",
              \"0331fc\",
              \"03fc20\",
              \"ffe600\",
              \"ff1212\"
            ],
            \"renderValuesOutOfRangeAsTransparent\": \"AboveAndBelow\"
          }
        ]
    }
  ]
}"

Retrieve tiles metadata

Now that we have tiles generated for dataset, we could retrieve tiling metadata as in the example below.

Click to show example shell script
projectid="<replacewithprojectid>"
openapikey="<replacewithopenapikey>"
datasetid="<replacewithdatasetid>"

curl -L -X GET "https://api.mike-cloud-test.com/api/tiles/dataset/$datasetid/metadata" \
  -H 'Content-Type: application/json' \
  -H "dhi-open-api-key: $openapikey" \
  -H "dhi-project-id: $projectid" \
  -H "dhi-dataset-id: $datasetid" \
  -H "dhi-service-id: tiles" \
  -H "api-version: 1" \