Miscellaneous Location
The MiscLocation class allows users to manage miscellaneous locations in the Fleet Management SDK. MiscLocations are points of interest, depots, or other locations relevant to logistics and route optimization. This API provides endpoints to:
- Add new miscellaneous locations to the system.
- Retrieve and update location details such as alias, address, and coordinates.
- Delete miscellaneous locations when they are no longer needed.
Miscellaneous locations can be used as departure points. For more information, see Departure
Additionally, miscellaneous locations can also serve as destinations. Refer to Destination for further details."
MiscLocation Structure
Each miscellaneous location object consists of the following attributes:
| Name | Type | Description | Setter | Getter |
|---|---|---|---|---|
| Id | LargeInteger | Unique identifier for the miscellaneous location. | ❌ | ✅ |
| IsDepot | bool | Indicates whether the location is a depot. | ✅ | ✅ |
| Coordinates | Coordinates | Geographical coordinates of the miscellaneous location. | ✅ | ✅ |
| Address | AddressInfo | Address information of the miscellaneous location. | ✅ | ✅ |
| Alias | String | Alias name of the miscellaneous location. | ✅ | ✅ |
Managing MiscLocations
Creating a MiscLocation
Add a miscellaneous location to the agenda, allowing it to be utilized as a point of interest, depot, or any other location relevant to logistics and route optimization.
If the operation is successful, the miscLocation will have an id assigned; which can be retrieved using the method miscLocation.getId(), if not, an error code is returned which can be interpreted as mentioned at the end of the page.
How it works
- Create a
vrp::MiscLocationand set the desired fields. - Create a
ProgressListenerandvrp::Service. - Call the
addMiscLocation()method from thevrp::Serviceusing thevrp::MiscLocationandProgressListenerand wait for the operation to be done.
Example
Retrieving MiscLocations
There are two ways to retrieve MiscLocation data:
a) Get a MiscLocation by ID
Get a certain MiscLocation by ID.
How it works
- Create a
ProgressListener, avrp::Serviceand avrp::MiscLocation. - Call the
getMiscLocation()method from thevrp::Serviceusing thevrp::MiscLocationfrom 1.), the ID of the miscLocation that you want to retrieve and theProgressListener. - Once the operation completes, the
vrp::MiscLocationfrom 1.) will be populated.
b) Get All MiscLocations
Returns all miscLocations of the API user (which contain the search term).
How it works
- Create a
ProgressListenerandvrp::Serviceand avrp::MiscLocationList. - Call the
getMiscLocations()method from thevrp::Serviceand theProgressListener. - Once the operation completes, the list from 1.) will be populated with miscLocations that match the search criteria.
Updating a MiscLocation
Saves the updates made to a miscLocation. MiscLocations can be updated with new alias, address, or coordinates.
How it works
- Create a
ProgressListenerand avrp::Service. - Retrieve the miscLocation you want to update (see Get MiscLocation) in a
vrp::MiscLocation. - Change the desired fields of the
vrp::MiscLocation. - Call the
updateMiscLocation()method from thevrp::Serviceusing thevrp::MiscLocationfrom 2.) andProgressListenerand wait for the operation to be done.
Example
Deleting a MiscLocation
MiscLocations can be deleted individually or in bulk.
If a miscellaneous location that needs to be deleted was previously used to create orders or as a departure point, the id_depot in those orders or the departure field will be set to 0.
How it works
- Create a
ProgressListenerandvrp::Service. - Call the
deleteMiscLocation()method from thevrp::Serviceusing the miscLocation object andProgressListenerand wait for the operation to be done.
Error Handling
This API returns specific error codes to indicate potential issues. Below is a summary of common errors and how to resolve them:
| Error Code | Description | Solution |
|---|---|---|
KInvalidInput | Missing required fields or invalid data. | Ensure all mandatory fields are properly filled. |
KNotFound | The specified MiscLocation ID does not exist. | Verify that the correct location ID is provided. |
KInternalAbort | Server-side issue or unexpected parsing error. | Retry the request or check API status. |
Departure
Overview
Departures in Fleet Management SDK define the starting points for vehicle routes. These locations serve as the origin of a route and can impact optimization by influencing travel distance and time.
Departure Structure
Each Departure consists of:
| Name | Type | Description | Setter | Getter |
|---|---|---|---|---|
| DepotId | LargeInteger | Unique identifier for the depot associated with the departure. | ✅ | ✅ |
| Alias | String | Alias name of the departure. | ✅ | ✅ |
| Coordinates | Coordinates | Geographical coordinates (latitude, longitude) of the departure. | ✅ | ✅ |
| MatchedCoordinates | Coordinates | Matched geographical coordinates (latitude, longitude) of the departure. | ❌ | ✅ |
| Address | AddressInfo | Address information of the departure. | ✅ | ✅ |
| NumberOfPackages | unsigned int | Number of packages with which the vehicle is loaded. Default is 0. | ❌ | ✅ |
| Weight | float | Weight with which the vehicle is loaded. Default is 0. | ❌ | ✅ |
| Cube | float | Cubic volume with which the vehicle is loaded. Default is 0. | ❌ | ✅ |
| DepartureTime | Time | Time at which the vehicle departs from the location. | ❌ | ✅ |
| TimeToNext | unsigned int | Time required to travel to the next order. | ❌ | ✅ |
| DistanceToNext | float | Distance to the next order in the distance unit set in the ConfigurationParameters. | ❌ | ✅ |
Example Usage
Setting precise departure locations improves route planning and boosts the efficiency of vehicle operations with the Fleet Management SDK.
Destination
Overview
Destinations in Fleet Management SDK define the final stop for a vehicle route. These locations mark the endpoint of a route and play a key role in optimizing route efficiency.
Destination Structure
Each Destination consists of:
| Name | Type | Description | Setter | Getter |
|---|---|---|---|---|
| Alias | String | Alias name of the destination. | ✅ | ✅ |
| Coordinates | Coordinates | Geographical coordinates (latitude, longitude) of the destination. | ✅ | ✅ |
| MatchedCoordinates | Coordinates | Matched geographical coordinates (latitude, longitude) of the destination. | ❌ | ✅ |
| Address | AddressInfo | Address information of the destination. | ✅ | ✅ |
| ArrivalTime | Time | Time at which the vehicle arrives at the destination. | ❌ | ✅ |
| TraveledDistance | float | Distance traveled by the vehicle to reach this destination, in the distance unit set in the ConfigurationParameters. | ❌ | ✅ |
Example Usage
By accurately managing destination locations, ensures optimal route planning and timely deliveries.