# Near POI

REST API, Service version 1.0.0

> API reference: [`POST /nearpoi/1.0`](https://benomad.com/dev/doc/bemap-api/api/map-context/nearpoi.md)

Find POI around a coordinate, limited by distance of travel from coordinate to POI.

![Illustration of near POI service](https://benomad.com/dev/doc/bemap-api/guides/images/nearpoi-service-map_example.svg)

## Summary
1. Request
 1. Parameters
2. Response
 1. Details of fields
 2. Response samples

## Request
The request must be sent with the HTTP method `POST` and the HTTP header `Content-Type` set to `application/json`.

Sample:
URI: `/bgis/service/nearpoi/1.0`

POST data:
```javascript
{
 "coordinate": {
  "longitude": 2.40552,
  "latitude": 48.85342
 },
 "distance": 70,
 "transportType": "PEDESTRIAN",
 "orderBy": "DISTANCE_ASC"
}
```

### __Parameters__

- `coordinate` (CoordinateSat, required): Coordinate of center of research, will be used with `distance` parameter.
  - `lon` (number (double), required): Longitude in degrees decimal ([WGS84](https://benomad.com/dev/doc/bemap-api/guides/reference/glossary-coordinate-system.md)). Also accepted as `longitude`.
  - `lat` (number (double), required): Latitude in degrees decimal ([WGS84](https://benomad.com/dev/doc/bemap-api/guides/reference/glossary-coordinate-system.md)). Also accepted as `latitude`.
  - `heading` (number (double)): Heading in degrees.
  - `speed` (number (float)): Speed in km/h.
  - `time` (integer (int64)): GPS time in milliseconds (EPOCH).
  - `sat` (integer (int32)): Number of GPS satellites available.
- `distance` (integer (int64), required): Limit of research in meters.
- `geoserver` (string): Geoserver name.
- `swidx` (integer (int32), deprecated): Switch index.
- `transportType` (enum): Define the transportation mode: Car, pedestrian, truck, etc. By default PEDESTRIAN.
  - `PEDESTRIAN`: Pedestrian.
  - `BICYCLE`: Bicycle.
  - `MOTORCYCLE`: Motorcycle.
  - `CAR`: Passenger car.
  - `TAXI`: Taxi.
  - `PUBLIC_BUS`: Public bus.
  - `EMERGENCY`: Emergency vehicle.
  - `DELIVERY_TRUCK`: Delivery truck. Deprecated, use `TRUCK` instead.
  - `TRUCK`: Truck.
- `orderBy` (enum): Sort the result by distance or duration in either ascending or descending. Disable by default.
  - `DISTANCE_ASC`: Sort by distance in either ascending.
  - `DISTANCE_DESC`: Sort by distance in either descending.
  - `DURATION_ASC`: Sort by duration in either ascending.
  - `DURATION_DESC`: Sort by duration in either descending.
- `pl` (boolean): Enable the output polyline geometry of route. Set to true to enable otherwise false. Disable by default.
- `epl` (boolean): Enable the output encoded polyline geometry of route with Google Algorithm. Set to true to enable otherwise false. Disable by default.
- `serviceCategories` (string[]): Service categories. POI Class ID (numeric value defining the type of service, see the `Class ID list` in Glossary menu).

## Response
Return the list of POI around the input coordinate.

### Details of fields

- `pois` (NearPoint[]): Points of interests.
  - `coordinate` (Coordinate): Geographical coordinate of POI.
    - `lon` (number (double), required): Longitude in degrees decimal ([WGS84](https://benomad.com/dev/doc/bemap-api/guides/reference/glossary-coordinate-system.md)). Also accepted as `longitude`.
    - `lat` (number (double), required): Latitude in degrees decimal ([WGS84](https://benomad.com/dev/doc/bemap-api/guides/reference/glossary-coordinate-system.md)). Also accepted as `latitude`.
  - `distance` (integer (int64)): Distance of travel in meters between the input coordinate and POI.
  - `duration` (integer (int64)): Duration of travel in seconds between the input coordinate and POI.
  - `type` (string): Type of POI.
  - `name` (string): Name of POI.
  - `telephone` (string): Phone number of POI.
  - `comment` (string): Comment.
  - `polyline` (CoordinateFullName[]): Polyline geometry of route between start coordinate and the POI.
    - `longitude` (number (double), required): Longitude in degrees decimal (WGS84) (double).
    - `latitude` (number (double), required): Latitude in degrees decimal (WGS84) (double).
    - `altitude` (number (double)): Altitude in meters.
  - `encodedPolyline` (string): Polyline geometry of route between start coordinate and the POI. It is a composed of coordinates list and encoded with Google Algorithm.

### Response samples

JSON Sample:
```javascript
{
	"pois": [{
			"coordinate": {
				"longitude": 2.40595,
				"latitude": 48.85328
			},
			"distance": 54,
			"duration": 61,
			"type": "SHOP",
			"name": "JEAN CARIL",
			"telephone": "+(33)-1-43675352"
		}, {
			"coordinate": {
				"longitude": 2.40577,
				"latitude": 48.85382
			},
			"distance": 64,
			"duration": 67,
			"type": "RESTAURANT",
			"name": "JARDIN D'OR",
			"telephone": "+(33)-1-44649320"
		}, {
			"coordinate": {
				"longitude": 2.40598,
				"latitude": 48.85316
			},
			"distance": 68,
			"duration": 66,
			"type": "RESTAURANT",
			"name": "MAXILIFE",
			"telephone": "+(33)-1-43792928"
		}, {
			"coordinate": {
				"longitude": 2.40575,
				"latitude": 48.85386
			},
			"distance": 68,
			"duration": 71,
			"type": "RESTAURANT",
			"name": "LE MONTANA",
			"telephone": "+(33)-1-43483873"
		}
	]
}
```
