Detects if the user is traveling on an exit-based US highway by using two consecutive location coordinates.

JSON Response

KeyValueDescription
statusInteger100 = On Highway
200 = Near Highway
300 = Not On Highway
status_messageString"On Highway", "Near Highway", or "Not On Highway"
exitsArray of Exits[Optional]. This is only present if we are "On Highway" or "Near Highway".

If in the case of "Near Highway", you can present the user with a menu comprised of all results from this array and let them select which highway they would like to be placed on.

If present, you can feed the exit.id to the Upcoming Exits API.

The most powerful capability of the iExit API is to be able to detect if a user is currently traveling on an exit-based highway and if so, display upcoming exits ahead of them in real time. You should be able to picture this as a nice feature that pops up on your smart car's infotainment dashboard the moment you pull onto the highway. This API, along with the Upcoming Exits API, make this possible.

The idea behind the On Highway Detection API is simple: provide two consecutive locations so that we may know your direction of travel, and it will return whether you are on or off the highway. Look at the example below, where the red pin (<33.509739, -86.819707>) is the user's previous location and the green pin (<33.511262, -86.820773>) is their current location.

434

The two coordinates used in the above example of a successful On Highway detection. The red coordinate is the user's previous location, and the green is their current location. They are, in fact, traveling on I-65 Northbound.

As you can see, this user is traveling on I-65 Northbound near Birmingham, Alabama. And if you enter these two coordinates into this API, you will see that it returns a status of "On Highway" along with an Exit object in the starting_exit field to use with the Upcoming Exits API.

Now consider the example below. The red previous location (<33.511273, -86.820006>) and the green current location (<33.510638, -86.821334>) show that the user is not on the highway. Despite these location's proximity to I-65, they are traveling perpendicular to the highway, which the API is smart enough to detect. So because this user is not on the highway, we will not return a Status:100 response. But since they are near several highway (I-65, I-20, and I-59), we will return a Status:200 (Near Highway) response with 6 exits in the exits array. These 6 exits are made up of 1) I-65 N, 2) I-65 S, 3) I-20 E, 4) I-20 W, 5) I-59 N, and 6) I-59 S.

518

These two coordinates would result in this API returning Not On Highway. Even though they are near I-65, their direction of travel prevents them from being placed on I-65.

In the iExit Android app, when a user selects "Fine Me On The Highway", the first step is to make a background HTTP request to this API. If it returns with a Status:100 (On Highway) response, then we know the user is on the highway and then we can use the exit.id value as input to the Upcoming Exits API.

720

This is the overlay shown in the iExit Android app when it's requesting this API to determine if the user is on the highway.

Common Next API(s)

  • Upcoming Exits (by using starting_exit.id if status == "On Highway".
Language
Authorization
Header
Click Try It! to start a request and see the response here!