---
title: "Render a parcel image (PNG) - JSON body variant"
description: "Renders a styled PNG of the parcel from the GeoServer WMS. Location is given by `lat`/`lng` or by `x_3857`/`y_3857` (Web Mercator)."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.aireon.ch/llms.txt
> Use this file to discover all available pages before exploring further.

Path: RES API (public) › Parcel

`POST /res_api/parcel_image`

Renders a styled PNG of the parcel from the GeoServer WMS. Location is given by `lat`/`lng` or by `x_3857`/`y_3857` (Web Mercator).

## Authentication

- `ResApiToken`, apiKey, in header, header `token`

## Request body

_Required._

- `lat` (`getParcelImagePost.lat`; number, optional): WGS84 latitude.
- `lng` (`getParcelImagePost.lng`; number, optional): WGS84 longitude.
- `x_3857` (`getParcelImagePost.x_3857`; number, optional): Web Mercator X coordinate.
- `y_3857` (`getParcelImagePost.y_3857`; number, optional): Web Mercator Y coordinate.
- `img_size` (`getParcelImagePost.img_size`; integer, optional): Output image width/height, in pixels.
  - default `512`
- `bounding_dist` (`getParcelImagePost.bounding_dist`; number, optional): Half-extent of the rendered bounding box, in metres.
  - default `200`
- `style` (`getParcelImagePost.style`; string, optional): Render style.
  - one of `"ratio_v_free"`, `"score"`, `"red"`, `"green"`; default `"ratio_v_free"`

## Example request

```json
{
  "lat": 0,
  "lng": 0,
  "x_3857": 0,
  "y_3857": 0,
  "img_size": 512,
  "bounding_dist": 200,
  "style": "ratio_v_free"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://res.aireon.ch/res_api/parcel_image \
  --header 'Content-Type: application/json' \
  --header 'token: <token>' \
  --data '
{
  "lat": 0,
  "lng": 0,
  "x_3857": 0,
  "y_3857": 0,
  "img_size": 512,
  "bounding_dist": 200,
  "style": "ratio_v_free"
}
'
```

### TypeScript

```typescript
const url = 'https://res.aireon.ch/res_api/parcel_image';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', token: '<token>'},
  body: JSON.stringify({
    lat: 0,
    lng: 0,
    x_3857: 0,
    y_3857: 0,
    img_size: 512,
    bounding_dist: 200,
    style: 'ratio_v_free'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://res.aireon.ch/res_api/parcel_image"

payload = {
    "lat": 0,
    "lng": 0,
    "x_3857": 0,
    "y_3857": 0,
    "img_size": 512,
    "bounding_dist": 200,
    "style": "ratio_v_free"
}
headers = {
    "Content-Type": "application/json",
    "token": "<token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

PNG image, or a plain-text error body.

#### Body (text/html)

##### Example

```text
Wrong Token
```

#### Body (image/png)

##### Example

```text
string
```

### 401

Authentication missing or invalid.

#### Example

```json
{
  "error": "string",
  "message": "string"
}
```

- `error` (`getParcelImagePost.response.401.error`; string, required): Human-readable error description.
- `message` (`getParcelImagePost.response.401.message`; string, optional): Optional underlying error message.

### 500

Internal failure while building the WMS request. Plain text, `Cache-Control: no-store`.

#### Example

```text
string
```

### 502

GeoServer WMS unreachable, or it answered a non-2xx status or a non-image body (a WMS ServiceException). Plain text, `Cache-Control: no-store`.

#### Example

```text
string
```


Source: https://docs.aireon.ch/res/get-parcel-image-post/index.md
