# /aggregate

## aggregate location from layer.

<mark style="color:blue;">`GET`</mark> `geolytix.xyz/api/location/select/aggregate`

Query a layer to create an aggregate geojson feature.

#### Query Parameters

| Name   | Type   | Description                                                                    |
| ------ | ------ | ------------------------------------------------------------------------------ |
| locale | string | The locale key.                                                                |
| layer  | string | The layer key.                                                                 |
| table  | string | The PostGIS table name.                                                        |
| filter | string | A stringified filter object to be applied before calculating aggregate scores. |
| token  | string | Required to access private endpoints.                                          |

{% tabs %}
{% tab title="200 A geojson feature with aggregate bounds as geometry and aggregate infoj." %}
```javascript
{
  "geomj": "{\"type\":\"Polygon\",\"coordinates\":[[[-0.179857004199384,51.5217345604859],[-0.182423511339462,51.5218918437182],[-0.18489138904946,51.5223576459222],[-0.187165798172985,51.5231140575055],[-0.189159334442924,51.5217345604859]]]}",
  "infoj": [
    {
      "label": "ID count",
      "field": "id_count",
      "type": "integer",
      "inline": true,
      "fieldfx": "count(retailpoint_id)",
      "value": "82"
    }
  ]
}
```
{% endtab %}

{% tab title="406 Query with missing or invalid parameter." %}
```
'Invalid locale.'

'Layer not found.'

'Table not found.'
```
{% endtab %}

{% tab title="500 Please check backend error logs for more details." %}
```
'Failed to query PostGIS table.'
```
{% endtab %}
{% endtabs %}

