---
title: "Search nearby locations"
method: POST
path: "/v1/spatial/findNearest"
tags: ["Spatial Analysis"]
---

# Search nearby locations

`POST /v1/spatial/findNearest`

## Request

- Base URL: `https://api.cloud.precisely.com`
- URL: `https://api.cloud.precisely.com/v1/spatial/findNearest`
- Auth: one of:
  - `bearerAuth` (a scheme the document does not define)
  - `ApiKeyAuth` (a scheme the document does not define)

Identifies nearest features from a table relative to an input geometry or address, within a required search distance. Supports result limiting, attribute filtering, custom distance/unit column names, and custom inputPoint/targetPoint/bearing attribute names. By default, results are ordered from nearest to farthest distance, with optional sortBy/sortOrder override.

## Query parameters

- `sortBy` string
- `sortOrder` string
- `limit` integer
- `offset` integer

## Headers

- `X-Request-Id` string

## Request body

- FindNearestRequest
  - `tableName` string, required: Name of the table containing spatial data used by the operation.
  - `location` Location
    - `format` 'wkt' | 'geojson' | 'lonlat' | 'address': Format of the location input. Allowed values: WKT, GEOJSON, LonLat, Address. Default value is WKT.
    - `value` string, required: Input geometry or address value. Geometry coordinates must use EPSG:4326 (longitude, latitude).
    - `country` string: Country for address input. Mandatory when format is Address.
  - `attributeFilter` string: Optional scalar attribute filter expression using logical operators (AND/OR/NOT) and comparison operators such as =, <>, <, <=, >, >=, IS NULL, LIKE, BETWEEN, and IN.
  - `distanceAttributeName` string: Custom name for the response distance attribute between input and target geometries. Default value is "distance".
  - `withinDistance` string, required: Distance around the input geometry used for nearest search. Include both value and unit, for example "10 mi" or "5 km". Allowed units: mi, km, ft, m, nm.
  - `attributes` string[], required: List of table attributes to include in the response. Use ["*"] to return all attributes.
  - `maxFeatures` integer: Maximum number of features returned for each input geometry. Default value is 1; minimum is 1.
  - `uomAttributeName` string: Custom name for the response unit-of-measure attribute. Default value is "uom".
  - `inputPointAttributeName` string: Custom base name for input-point coordinates in the response. The service appends _x and _y. Default base name is "inputPoint".
  - `targetPointAttributeName` string: Custom base name for target-point coordinates in the response. The service appends _x and _y. Default base name is "targetPoint".
  - `bearingAttributeName` string: Custom name for the response bearing attribute. Bearing is decimal degrees from input point to target point where north is 0 and values increase clockwise.

## Response `200`

Successful retrieval of find nearest operations

## Other responses

- `400`: Invalid request
- `401`: Unauthorized: Invalid token
- `403`: Forbidden
- `429`: Too many requests
- `500`: Internal Server Error
- `503`: Service Unavailable

---

[API](https://skmtc.dev/precisely/apis/feature-api.md) · [All operations](https://skmtc.dev/precisely/apis/feature-api/llms.txt) · [OpenAPI document](https://skmtc.dev/precisely/apis/feature-api/revisions/6dc26f89c0aa?raw)
