MTS Nearby Search
The MTS Nearby Search API extends Motion Tracking Service by providing the capability to search for nearby devices (vehicles or drivers) that are close to the specified point of interest. You can sort the search for devices can be done using radial distance or by the most recent timestamp. Applications that require real-time proximity data can use Nearby search API to optimize their driver/vehicle allocation. The Nearby Search API enables applications to:
- Provide latitude and longitude for a given point of interest.
- Specify the radial distance to filter nearby vehicles or devices within the vicinity.
- Sort results by the most recent timestamp using sortByTis.
- Control the number of results returned in each response with the limit parameter. You can set how many results you want to see at once, up to a maximum of 50.
The Nearby Search API is useful in several scenarios:
Find Nearby Riders for Last-Mile Delivery:
When an order is received, the app needs to find the riders within a specified radial distance from the pickup location. The API enables hyper-local and last-mile applications to search for nearby riders and sort them by the most recent timestamp to track the status or location and identify who can pick up the package the fastest.
Food Delivery:
When an order is ready for pickup, the app needs to locate riders within the shortest radial distance from the restaurant.The API allows the app to quickly notify available riders who are up-to-date with their current location and availability.
Transport Management System (TMS):
When a logistics manager needs to fulfill delivery demands, the app needs to find nearby available vehicles within a specified radius. The API provides a list of nearby vehicles and sorts them by the most recent timestamp.
This section explains how to use the Nearby API, including key parameters and customization options. You'll learn how to configure requests to find nearby devices, as well as how to tailor responses to meet specific application needs.
To use the Nearby Search API, follow the steps below:
- Create an MTS track Before you can use the Nearby Search API, you need to create an MTS track. This is required to track devices and their movements. Refer to Create MTS track for the detailed steps.
- Insert Traces After you have created an MTS Track, insert trace data pertaining to that track. Refer to Insert Traces for the detailed steps.
- Perform a Nearby Search After creating an MTS track and updating or inserting traces, you can now use the API to find devices within a specific vicinity. Provide the latitude and longitude of a trace to search for nearby devices. The API will return details based on the provided coordinates.
The following parameters allow you to tailor the search based on location, distance, and other criteria.
Parameter | Data Type | Description | Required |
| | | |
center | string | Latitude and longitude of the point-of-interest which will be considered as the origin for the search to be conducted. | Yes |
radius | number | Radial distance from the point-of-interest in kilometers | Yes |
| | | |
mode | string | Denotes the types of provider sending trace data such as smartphone. | Optional |
sortByTis | string | Timestamp (in milliseconds) of when the device was last seen. | Optional |
limit | integer | Maximum number of results to return in a single response. | Optional |
offset | string | Number of results to skip before returning the next set. | Optional |
Below is a sample example of how the Nearby Search API fetches a list of nearby available devices based on radial distance and sort by timestamp.
GET /core/api/v1/mts/nearby-search?center=28.6514657,77.2378349&radius=16 |
In this example:
- The request specifies the center coordinates and a radius of 16 kilometers.
- The response returns an array of devices with their respective latitude (lat), longitude (lon), deviceId, distance from the center, and mode.
To learn more about Nearby Search API, refer to our API reference documentation.