# hidePolygon

Command (Map).

Remove specific Polygon(s) from MapView, destroy their associated PolygonStyle if not in use anymore

Removes areas from the map by id, leaving the others in place, for a zone that no longer applies,
without redrawing the rest.

**Worth knowing**

- Omit the id list entirely to clear every polygon. An **empty** list matches nothing
  and returns `19 polygon.not.found`.

## Command

```json
{
    "id": "Hide_Selected_Polygon",
    "jsonrpc": "2.0",
    "method": "hidePolygon",
    "params" : {
        "polygonIds" : [
            "Polygon A - Red Border Blue Fill",
	        "Polygon B - Green Border Yellow Fill Thick"
        ]
    }
}
```

- `polygonIds` List of unique Polygon identifiers given as `id` in the [`showPolygon`](https://docs.benomad.com/benav-rnc/commands/show-polygon.md) command

  - Send `"params": {}` with no `polygonIds` to hide every polygon. The `params` object itself must be present: a command with no `params` key is rejected with `-32700 parse.error`. An **empty array** matches nothing and returns `19 polygon.not.found`.

```json
{
    "id": "Hide_All_Polygons",
    "jsonrpc": "2.0",
    "method": "hidePolygon",
    "params": {}
}
```

## Response

### Success

Generic responses

### Error

if not a single id is found

```json
{
    "error": {
        "code": 19,
        "message": "polygon.not.found"
    },
    "id": "test_hide",
    "jsonrpc": "2.0"
}
```
