# Add raster style

This API call has been replaced. See [this page](/developers/api-v3/path-raster/styles/add-style.md) to find the new documentation.

| **Description** | Adds a raster style.          |
| --------------- | ----------------------------- |
| **Endpoint**    | `/path/{pathId}/raster/style` |
| **Method**      | POST                          |

### Access Level Rules

| **Minimum Access Level** | edit+ |
| ------------------------ | ----- |

### Processing Units

| **Minimum processing units** | 2 |
| ---------------------------- | - |

### Parameters

<table><thead><tr><th>Name</th><th width="385">Description</th><th>Required</th><th>Default</th></tr></thead><tbody><tr><td><code>pathId</code></td><td>The id of the raster layer.</td><td>true</td><td></td></tr><tr><td><code>name</code></td><td>The name of the layer to add.</td><td>true</td><td></td></tr><tr><td><code>method</code></td><td>Name of the visualization method. Must be one of the following:<br>- bandToColor<br>- hillShade<br>- vectorField<br>- rgb<br>- formula<br>- classToColor</td><td>true</td><td></td></tr><tr><td><code>parameters</code></td><td>The parameter for the visualization. See details on the required parameters for every styling method in the table below.</td><td>true</td><td></td></tr><tr><td><code>description</code></td><td>A description as string.</td><td>false</td><td>Default null.</td></tr></tbody></table>

#### Sample requests for different methods

{% tabs %}
{% tab title="RGB" %}

```json
//Assings bands to a specific color channel (red, green or blue)
{
    "method": "rgb",
    "name": "Create a false or true color image based on 3 bands",
    "parameters": {
        "bands": [
            {
                "bandNumber": 1,
                "color": "red",
                "bias": 1,
                "weight": 8
            },
            {
                "bandNumber": 2,
                "color": "green",
                "bias": -4,
                "weight": 3
            },
            {
                "bandNumber": 3,
                "color": "blue",
                "bias": -3,
                "weight": 2.3
            }
        ],
        "alpha": 1,
        "noData":[{"bandNumber":1,"fromValue":0,"toValue":1}]}
    }
}
```

{% endtab %}

{% tab title="bandToColor" %}

```json
//Allows you to define bins. Colors are given based on the bin in which the pixel value falls.
{
    "method": "bandToColor",
    "name": "Map to a color based on a band value",
    "parameters": {
        "alpha": 1,
        "bandNumber": 1,
        "continuous": true,
        "transitionPoints": [
            {
                "color": "#2A5C84",
                "value": 0
            },
            {
                "color": "#74AE56",
                "value": 51
            },
            {
                "color": "#FF8C01",
                "value": 153
            },
            {
                "color": "#ED2938",
                "value": 204
            }
        ],
        "noData":[{"bandNumber":1,"fromValue":0,"toValue":1}]},
    }
}
```

{% endtab %}

{% tab title="terrainRgb" %}

```json
//Creates a terrainRgb based on the chosen band.
{
    "method": "terrainRgb",
    "name": "Create a terrain rgb image to display altitude in mapLibre or mapBox",
    "parameters": {
        "bandsNumber":1,
        "alpha": 1,
        "offset": 1,
        "noData":[{"bandNumber":1,"fromValue":0,"toValue":1}]}
    }
}
```

{% endtab %}

{% tab title="hillShade" %}

```json
//Creats a hill shade for the chosen band.
{
    "method": "hillShade",
    "name": "Create a standard hill shade",
    "parameters": {
        "angle": 45,
        "azimuth": 90,
        "exaggerate": 1,
        "bandNumber": 1,
        "alpha": 1,
        "noData":[{"bandNumber":1,"fromValue":0,"toValue":1}]}
    }
}
```

{% endtab %}

{% tab title="vectorField" %}

```json
//Uses the two chosen bands as the x and y direction of a vector field.
{
    "method": "vectorField",
    "name": "Create vector field out of 2 bands",
    "parameters": {
        "alpha": 1,
        "xDirection": {
            "bandNumber": 1,
            "weight": 1,
            "bias": 2
        },
        "yDirection": {
            "bandNumber": 2,
            "weight": 1,
            "bias": 1
        },
        "clipValueMin": 1,
        "clipValueMax": 10,
        "noData":[{"bandNumber":1,"fromValue":0,"toValue":1}]}
    }
}
```

{% endtab %}

{% tab title="formula" %}

<pre class="language-json"><code class="lang-json"><strong>//Allows you to perform band algebra and sent the result to a color.
</strong><strong>{
</strong>        "method":"formula",
        "name":"pass a custom formula and map the result to a color"
        "parameters":{      
          "formula": "2*band1 + band2",
          "alpha": 1,
          "continuous": true,
          "transitionPoints":[{"color":"#2A5C84","value":25},{"color":"#74AE56","value":129.5},{"color":"#FFE733","value":234},{"color":"#FF8C01","value":338.5},{"color":"#ED2938","value":443}],
          "noData":[{"bandNumber":1,"fromValue":0,"toValue":1}]}
    }
}
</code></pre>

{% endtab %}

{% tab title="classToColor" %}

```json
//Allows you to assign specific pixel values to specific colors.
{
    "method": "classToColor",
    "name": "map an integer class to a color",
    "parameters": {
        "alpha": 1,
        "bandNumber": 1,
        "divisionFactor":1,
        "transitionPoints": [
            {
                "color": "#2A5C84",
                "value": 0
            },
            {
                "color": "#74AE56",
                "value": 1
            },
            {
                "color": "#FFE733",
                "value": 2
            },
            {
                "color": "#FF8C01",
                "value": 3
            },
            {
                "color": "#ED2938",
                "value": 4
            }
        ],
        "noData":[{"bandNumber":1,"fromValue":0,"toValue":1}]}      
    }
}
```

{% endtab %}
{% endtabs %}

#### RECOMMENDED READING

{% content-ref url="/pages/7711P7XyH055TRoq42rf" %}
[Style raster data](/working-with-raster-data/style-raster-data.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ellipsis-drive.com/developers/backwards-compatibility/add-raster-style.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
