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.

> For a complete documentation index, see https://developers.woosmap.com/llms.txt

# Within Features



# 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)
apiKeyquery

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

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

Private key with or without write permission.

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

Private key with or without write permission.

### Path Parameters

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

### Query Parameters

[`format`](#query-format)
stringDefaults to `geojson`

Available options:`geojson`, `wkb`

[`per_page`](#query-per-page)
integerDefaults to `10`

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

[`page`](#query-page)
integerDefaults to `1`

The result page to fetch.

### Request Body

application/json

[`geometry`](#req-geometry)
string | PolygonGeometryrequired

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

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

#Show 3 propertiesHide 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

The feature attributes

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

The pagination information

#Show 3 propertiesHide 3 properties

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

The previous page number if any.

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

The next page number if any.

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

The current page number.

### Errors

#401

Unable to locate credentials.

 

`application/json`

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

#402

Out of free quota.

 

`application/json`

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

#403

Credentials found, but not matching.

 

`application/json`

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

#404

Dataset was not found

 

`application/json`

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

#422

Validation Error

 

`application/json`

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

Show 3 propertiesHide 3 properties

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

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

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

#429

Rate limit reached

 

`application/json`

[`details`](#err-429-details)
stringrequired

```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)
```
