Styles

A style prescribes the appearance of a map tile when a rendered image format is requested.

The best way to achieve a custom style is to request raster tiles for client-side rendering. In some cases, though, a custom style may be needed for image tile rendering on the server. This endpoint enables authorized API accounts to contribute styles.

Only the API account that contributes a style can discover and manage it. Each style must have a unique name.


Style List

GET /products/{product-id-or-name}/styles

Request Examples

See Headers for request header details.

$ curl -n -X GET https://platform.api.wdtinc.com/products/4a79aeab-84f0-4dde-ae39-a20b4ccee878/styles \
-H "Accept: application/vnd.wdt+json; version=1"
$ curl -n -X GET https://platform.api.wdtinc.com/products/skywise-base-reflectivity/styles \
-H "Accept: application/vnd.wdt+json; version=1"

Response Example

See Status Codes for response code details. See Mapnik’s RasterColorizer for documentation on colors, modes, and stops.

HTTP/1.1 200 OK
[
  {
    "id": "0cadca40-1d71-46f8-8c14-a1780e43d76c",
    "name": "default-radar",
    "description": "WDT default radar reflectivity style",
    "layerName": "reflectivity",
    "colorizers": [
      {
        "defaultColor": "rgba(0, 0, 0, 0)",
        "defaultMode": "linear",
        "stops": [
          { "value": 0, "color": "rgba(0, 236, 236, 0)" },
          { "value": 5, "color": "rgba(0, 236, 236, 15)" },
          { "value": 10, "color": "rgba(0, 160, 246, 95)" },
          { "value": 15, "color": "rgba(0, 0, 246, 180)" },
          { "value": 20, "color": "#00ff00" },
          { "value": 25, "color": "#00c800" },
          { "value": 30, "color": "#009000" },
          { "value": 35, "color": "#ffff00" },
          { "value": 40, "color": "#e7c000" },
          { "value": 45, "color": "#ff9000" },
          { "value": 50, "color": "#ff0000" },
          { "value": 55, "color": "#d60000" },
          { "value": 60, "color": "#c000ff" },
          { "value": 65, "color": "#ff00ff" },
          { "value": 70, "color": "#9955c9" },
          { "value": 75, "color": "#ffffff" }
        ]
      }
    ],
    "isDefault": true,
    "product": "/products/4a79aeab-84f0-4dde-ae39-a20b4ccee878"
  },
  {
    "id": "460680c8-db62-4a6f-90e1-95032be686f4",
    "name": "precip-typed-radar",
    "description": "WDT precipitation-typed radar reflectivity style",
    "layerName": "reflectivity",
    "colorizers": [
      {
        "mask": {
          "layerName": "precip_mask",
          "attributes": [ "rain" ]
        },
        "defaultColor": "rgba(0, 0, 0, 0)",
        "defaultMode": "linear",
        "stops": [
          { "value": 0, "color": "rgba(0, 238, 0, 0)" },
          { "value": 5, "color": "rgba(0, 238, 0, 15)" },
          { "value": 10, "color": "rgba(0, 221, 0, 95)" },
          { "value": 15, "color": "rgba(0, 204, 0, 180)" },
          { "value": 20, "color": "#00aa00" },
          { "value": 25, "color": "#009900" },
          { "value": 30, "color": "#006600" },
          { "value": 35, "color": "#c8de00" },
          { "value": 40, "color": "#ffff00" },
          { "value": 45, "color": "#ffaa00" },
          { "value": 50, "color": "#ff0000" },
          { "value": 55, "color": "#cc0000" },
          { "value": 60, "color": "#ff00ff" },
          { "value": 65, "color": "#ff99ff" },
          { "value": 70, "color": "#ff88ff" },
          { "value": 75, "color": "#ffc5ff" },
          { "value": 95, "color": "#ffffff" }
        ]
      },
      {
        "mask": {
          "layerName": "precip_mask",
          "attributes": [ "sleet", "freezing_rain" ]
        },
        "defaultColor": "rgba(0, 0, 0, 0)",
        "defaultMode": "linear",
        "stops": [
          { "value": 0, "color": "rgba(229, 182, 172, 0)" },
          { "value": 5, "color": "rgba(229, 182, 172, 15)" },
          { "value": 10, "color": "rgba(229, 149, 138, 95)" },
          { "value": 15, "color": "rgba(229, 115, 103, 180)" },
          { "value": 20, "color": "#e55245" },
          { "value": 25, "color": "#d24d43" },
          { "value": 30, "color": "#bf4841" },
          { "value": 35, "color": "#ac423f" },
          { "value": 40, "color": "#993d3d" },
          { "value": 45, "color": "#8c3b3d" },
          { "value": 50, "color": "#80383c" },
          { "value": 55, "color": "#73363c" },
          { "value": 60, "color": "#66333b" },
          { "value": 65, "color": "#442227" },
          { "value": 70, "color": "#221114" },
          { "value": 75, "color": "#000000" }
        ]
      },
      {
        "mask": {
          "layerName": "precip_mask",
          "attributes": [ "snow" ]
        },
        "defaultColor": "rgba(0, 0, 0, 0)",
        "defaultMode": "linear",
        "stops": [
          { "value": 0, "color": "rgba(0, 255, 255, 0)" },
          { "value": 5, "color": "rgba(0, 255, 255, 15)" },
          { "value": 10, "color": "rgba(0, 213, 255, 95)" },
          { "value": 15, "color": "rgba(0, 170, 255, 180)" },
          { "value": 20, "color": "#0080ff" },
          { "value": 25, "color": "#0055ff" },
          { "value": 30, "color": "#002aff" },
          { "value": 35, "color": "#0000ff" },
          { "value": 40, "color": "#0000c8" },
          { "value": 50, "color": "#000096" },
          { "value": 60, "color": "#000064" },
          { "value": 70, "color": "#000032" }
        ]
      }
    ],
    "isDefault": false,
    "product": "/products/4a79aeab-84f0-4dde-ae39-a20b4ccee878"
  }
]

Style Creation

POST /products/{product-id-or-name}/styles

Request Examples

See Headers for request header details. See Mapnik’s RasterColorizer for documentation on colors, modes, and stops.

$ curl -n -X POST https://platform.api.wdtinc.com/products/4a79aeab-84f0-4dde-ae39-a20b4ccee878/styles \
-H "Accept: application/vnd.wdt+json; version=1" \
-H "Content-Type: application/json" \
-d '{
  "name": "contributed-radar-style",
  "description": "A contributed radar style",
  "layerName": "reflectivity",
  "colorizers": [
    {
      "defaultColor": "rgba(0, 0, 0, 0)",
      "defaultMode": "linear",
      "stops": [
        { "value": 10, "color": "rgba(55, 146, 18, 0)" },
        { "value": 30, "color": "#379212" },
        { "value": 40, "color": "#e4e412" },
        { "value": 50, "color": "#ff0000" }
      ]
    }
  ]
}'
$ curl -n -X POST https://platform.api.wdtinc.com/products/skywise-base-reflectivity/styles \
-H "Accept: application/vnd.wdt+json; version=1" \
-H "Content-Type: application/json" \
-d '{
  "name": "contributed-radar-style",
  "description": "A contributed radar style",
  "layerName": "reflectivity",
  "colorizers": [
    {
      "defaultColor": "rgba(0, 0, 0, 0)",
      "defaultMode": "linear",
      "stops": [
        { "value": 10, "color": "rgba(55, 146, 18, 0)" },
        { "value": 30, "color": "#379212" },
        { "value": 40, "color": "#e4e412" },
        { "value": 50, "color": "#ff0000" }
      ]
    }
  ]
}'

Response Example

See Status Codes for response code details. See Mapnik’s RasterColorizer for documentation on colors, modes, and stops.

HTTP/1.1 201 Created
{
  "id": "a3e8bf4d-0d01-492f-830d-2c9635e2c0bf",
  "name": "contributed-radar-style",
  "description": "A contributed radar style",
  "layerName": "reflectivity",
  "colorizers": [
    {
      "defaultColor": "rgba(0, 0, 0, 0)",
      "defaultMode": "linear",
      "stops": [
        { "value": 10, "color": "rgba(55, 146, 18, 0)" },
        { "value": 30, "color": "#379212" },
        { "value": 40, "color": "#e4e412" },
        { "value": 50, "color": "#ff0000" }
      ]
    }
  ],
  "isDefault": false,
  "product": "/products/4a79aeab-84f0-4dde-ae39-a20b4ccee878"
}

Style Information

GET /styles/{style-id}

Request Example

See Headers for request header details.

$ curl -n -X GET https://platform.api.wdtinc.com/styles/0cadca40-1d71-46f8-8c14-a1780e43d76c \
-H "Accept: application/vnd.wdt+json; version=1"

Response Example

See Status Codes for response code details. See Mapnik’s RasterColorizer for documentation on colors, modes, and stops.

HTTP/1.1 200 OK
{
  "id": "0cadca40-1d71-46f8-8c14-a1780e43d76c",
  "name": "default-radar",
  "description": "WDT default radar reflectivity style",
  "layerName": "reflectivity",
  "colorizers": [
    {
      "defaultColor": "rgba(0, 0, 0, 0)",
      "defaultMode": "linear",
      "stops": [
        { "value": 0, "color": "rgba(0, 236, 236, 0)" },
        { "value": 5, "color": "rgba(0, 236, 236, 15)" },
        { "value": 10, "color": "rgba(0, 160, 246, 95)" },
        { "value": 15, "color": "rgba(0, 0, 246, 180)" },
        { "value": 20, "color": "#00ff00" },
        { "value": 25, "color": "#00c800" },
        { "value": 30, "color": "#009000" },
        { "value": 35, "color": "#ffff00" },
        { "value": 40, "color": "#e7c000" },
        { "value": 45, "color": "#ff9000" },
        { "value": 50, "color": "#ff0000" },
        { "value": 55, "color": "#d60000" },
        { "value": 60, "color": "#c000ff" },
        { "value": 65, "color": "#ff00ff" },
        { "value": 70, "color": "#9955c9" },
        { "value": 75, "color": "#ffffff" }
      ]
    }
  ],
  "isDefault": true,
  "product": "/products/4a79aeab-84f0-4dde-ae39-a20b4ccee878"
}

Style Update

PUT /styles/{style-id}

Request Example

See Headers for request header details. See Mapnik’s RasterColorizer for documentation on colors, modes, and stops.

$ curl -n -X PUT https://platform.api.wdtinc.com/styles/a3e8bf4d-0d01-492f-830d-2c9635e2c0bf \
-H "Accept: application/vnd.wdt+json; version=1" \
-H "Content-Type: application/json" \
-d '{
  "name": "contributed-radar-style",
  "description": "A contributed radar style",
  "layerName": "reflectivity",
  "colorizers": [
    {
      "defaultColor": "rgba(0, 0, 0, 0)",
      "defaultMode": "discrete",
      "stops": [
        { "value": 10, "color": "rgba(55, 146, 18, 0)" },
        { "value": 30, "color": "#379212" },
        { "value": 40, "color": "#e4e412" },
        { "value": 50, "color": "#ff0000" }
      ]
    }
  ]
}'

Response Example

See Status Codes for response code details. See Mapnik’s RasterColorizer for documentation on colors, modes, and stops.

HTTP/1.1 200 OK
{
  "id": "a3e8bf4d-0d01-492f-830d-2c9635e2c0bf",
  "name": "contributed-radar-style",
  "description": "A contributed radar style",
  "layerName": "reflectivity",
  "colorizers": [
    {
      "defaultColor": "rgba(0, 0, 0, 0)",
      "defaultMode": "discrete",
      "stops": [
        { "value": 10, "color": "rgba(55, 146, 18, 0)" },
        { "value": 30, "color": "#379212" },
        { "value": 40, "color": "#e4e412" },
        { "value": 50, "color": "#ff0000" }
      ]
    }
  ],
  "isDefault": false,
  "product": "/products/4a79aeab-84f0-4dde-ae39-a20b4ccee878"
}

Style Removal

DELETE /styles/{style-id}

Request Example

See Headers for request header details.

$ curl -n -X DELETE https://platform.api.wdtinc.com/styles/a3e8bf4d-0d01-492f-830d-2c9635e2c0bf \
-H "Accept: application/vnd.wdt+json; version=1"

Response Example

See Status Codes for response code details.

HTTP/1.1 200 OK
{
  "id": "a3e8bf4d-0d01-492f-830d-2c9635e2c0bf",
  "name": "contributed-radar-style",
  "description": "A contributed radar style",
  "layerName": "reflectivity",
  "colorizers": [
    {
      "defaultColor": "rgba(0, 0, 0, 0)",
      "defaultMode": "discrete",
      "stops": [
        { "value": 10, "color": "rgba(55, 146, 18, 0)" },
        { "value": 30, "color": "#379212" },
        { "value": 40, "color": "#e4e412" },
        { "value": 50, "color": "#ff0000" }
      ]
    }
  ],
  "isDefault": false,
  "product": "/products/4a79aeab-84f0-4dde-ae39-a20b4ccee878"
}