---
description: API for setting terrain editing functions within the map.
---

# JSEditTerrain

> Created with the Module.getEditTerrain API.

```javascript
var editTerrain = Module.getEditTerrain();
```

### clear() → boolean

> Resets terrain editing.

{% tabs %}
{% tab title="Information" %}
* Sample
  * Refer to function clearEditTerrain.
  * [Sandbox\_Terrain Cut and Fill](https://sandbox.egiscloud.com/code/main.do?id=analysis_terrain_edit)
{% endtab %}

{% tab title="Template" %}
```javascript
```
{% endtab %}
{% endtabs %}

### create(coordinates, height, angle) → boolean

> Performs terrain cut and fill based on the analysis area.

{% tabs %}
{% tab title="Information" %}
| Name        | Type                               | Description                                                                    |
| ----------- | ---------------------------------- | ------------------------------------------------------------------------------ |
| coordinates | [JSVec3Array](../core/jsvec3array) | List of latitude and longitude coordinates for the cut and fill analysis area. |
| height      | number                             | Reference height for cut and fill (Reference: sea level, in meters)            |
| angle       | number                             | Slope angle for cut and fill (in degrees)                                      |

* Sample
  * Refer to function createEditTerrain.
  * [Sandbox\_Terrain Cut and Fill](https://sandbox.egiscloud.com/code/main.do?id=analysis_terrain_edit)
{% endtab %}

{% tab title="Template" %}
```javascript
```
{% endtab %}
{% endtabs %}

### createBoundary(min, max, height, angle) → boolean

> Performs terrain cut and fill based on the analysis range.

{% tabs %}
{% tab title="Information" %}
| Name   | Type                             | Description                                                         |
| ------ | -------------------------------- | ------------------------------------------------------------------- |
| min    | [JSVector2D](../core/jsvector2d) | Bottom left of the cut and fill area                                |
| max    | [JSVector2D](../core/jsvector2d) | Top right of the cut and fill area                                  |
| height | number                           | Reference height for cut and fill (Reference: sea level, in meters) |
| angle  | number                           | Slope angle for cut and fill (in degrees)                           |

* Sample
  * Refer to function createEditTerrain.
  * [Sandbox\_Terrain Cut and Fill](https://sandbox.egiscloud.com/code/main.do?id=analysis_terrain_edit)
{% endtab %}

{% tab title="Template" %}
```javascript
```
{% endtab %}
{% endtabs %}

### setEditFaceColor(data, width, height, type) → boolean

> Sets the texture for the ground and slope surfaces during terrain cut and fill.
>
> The data variable is based on a binary array of Uint8Array.

{% tabs %}
{% tab title="Information" %}
| Name   | Type    | Description                                                          |
| ------ | ------- | -------------------------------------------------------------------- |
| data   | object  | Image binary data.                                                   |
| width  | number  | Width of the image.                                                  |
| height | number  | Height of the image.                                                 |
| type   | boolean | Differentiates between ground and slope (true: ground, false: slope) |

* Sample
  * Refer to function createEditTerrain.
  * [Sandbox\_Terrain Cut and Fill](https://sandbox.egiscloud.com/code/main.do?id=analysis_terrain_edit)
{% endtab %}

{% tab title="Template" %}
```javascript
```
{% endtab %}
{% endtabs %}
