Source: https://developers.woosmap.com/api-reference/datasets-api/post-datasets-dataset_id-features-within/

> For clean Markdown of any page, append `.md` to the page URL.

> Routing index (which page answers which question): https://developers.woosmap.com/llms.txt

> Full page list: https://developers.woosmap.com/llms-full.txt

# Within Features



POST 
https://api.woosmap.com/datasets/{dataset\_id}/features/within

Search for features within geometry.

**Rate limit** : `20/1s`

![Within](https://postgis.net/workshops/postgis-intro/_images/st_within.png)

**Ratelimit:** 20/1s

### Authorization

[`key`](#authorization-datasets-publicapikey)

_apiKey · query_

Public key of the project usually starts with `woos-`

[`private_key`](#authorization-datasets-privateapikey)

_apiKey · query_

Private key with or without write permission.

[`X-Api-Key`](#authorization-datasets-privateapikeyheader)

_apiKey · header_

Private key with or without write permission.

### Path Parameters

[`dataset_id`](#path-dataset-id)

_string · required_

### Query Parameters

[`format`](#query-format)

_string · Defaults to geojson_

Available options: `geojson`, `wkb`

[`per_page`](#query-per-page)

_integer · Defaults to 10_

The maximum number of elements to return in a result page.

[`page`](#query-page)

_integer · Defaults to 1_

The result page to fetch.

### Request Body

application/json

[`geometry`](#req-geometry)

_string | PolygonGeometry · required_

A geometry can be passed as:

- A GeoJSON geometry object, limited to Polygon see [GeoJSON rfc7946](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1) for more information.
- A WKT geometry see [Well-known text representation](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry) for more information

[`buffer`](#req-buffer)

_number | null_

When set applies a buffer operation to input geometry see [Buffer Analysis](https://en.wikipedia.org/wiki/Buffer_analysis).

[`where`](#req-where)

_string_

Applies a Woosmap filter on feature attributes.

##### Example

```json
{
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          -10,
          -10
        ],
        [
          10,
          -10
        ],
        [
          10,
          10
        ],
        [
          -10,
          10
        ],
        [
          -10,
          -10
        ]
      ]
    ]
  },
  "buffer": 10,
  "where": "cost:<500"
}
```

### Response

200application/json

Successful Response

[`features`](#resp-200-features)

_object[] · required_

The list of FeatureSummaryResponse that matched the search

**3 properties**

features.[`id`](#resp-200-features-id)

_string (uuid) · required_

The feature ID.

features.[`geometry`](#resp-200-features-geometry)

_string | PolygonGeometry | PointGeometry_

The geometry WKB base64-encoded

features.[`attributes`](#resp-200-features-attributes)

_object | null_

The feature attributes

[`pagination`](#resp-200-pagination)

_object · required_

The pagination information

**3 properties**

pagination.[`prev`](#resp-200-pagination-prev)

_integer | null_

The previous page number if any.

pagination.[`next`](#resp-200-pagination-next)

_integer | null_

The next page number if any.

pagination.[`page`](#resp-200-pagination-page)

_integer · required_

The current page number.

### Errors

#401

Unable to locate credentials.

 

`application/json`

[`detail`](#err-401-detail)

_string · required_

#402

Out of free quota.

 

`application/json`

[`detail`](#err-402-detail)

_string · required_

#403

Credentials found, but not matching.

 

`application/json`

[`detail`](#err-403-detail)

_string · required_

#404

Dataset was not found

 

`application/json`

[`details`](#err-404-details)

_string · required_

#422

Validation Error

 

`application/json`

[`detail`](#err-422-detail)

_object[]_

**3 properties**

detail.[`loc`](#err-422-detail-loc)

_any[] · required_

detail.[`msg`](#err-422-detail-msg)

_string · required_

detail.[`type`](#err-422-detail-type)

_string · required_

#429

Rate limit reached

 

`application/json`

[`detail`](#err-429-detail)

_string · required_

```shell
curl -L 'https://api.woosmap.com/datasets/8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0/features/within/?private_key=YOUR_PRIVATE_API_KEY' \
-H 'content-type: application/json' \
-d '{
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          2.3522,
          48.8566
        ],
        [
          2.3622,
          48.8566
        ],
        [
          2.3622,
          48.8666
        ],
        [
          2.3522,
          48.8666
        ],
        [
          2.3522,
          48.8566
        ]
      ]
    ]
  }
}'
```

```javascript
const myHeaders = new Headers();
myHeaders.append("content-type", "application/json");

const raw = JSON.stringify({
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          2.3522,
          48.8566
        ],
        [
          2.3622,
          48.8566
        ],
        [
          2.3622,
          48.8666
        ],
        [
          2.3522,
          48.8666
        ],
        [
          2.3522,
          48.8566
        ]
      ]
    ]
  }
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("https://api.woosmap.com/datasets/8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0/features/within/?private_key=YOUR_PRIVATE_API_KEY", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

```python
import requests
import json

url = "https://api.woosmap.com/datasets/8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0/features/within/?private_key=YOUR_PRIVATE_API_KEY"

payload = json.dumps({
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [
                    2.3522,
                    48.8566
                ],
                [
                    2.3622,
                    48.8566
                ],
                [
                    2.3622,
                    48.8666
                ],
                [
                    2.3522,
                    48.8666
                ],
                [
                    2.3522,
                    48.8566
                ]
            ]
        ]
    }
})
headers = {
    'content-type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```
