Route

Request

The Route API is used to get the set of maneuvers between two different geographic coordinates (latitude/longitude) and includes real-time traffic.

GET https://apis.location.studio/geo/v2/route/json

Required Parameters

api_key

String

Your Location Studio API Key

origin

String

The latitude must be in the range of -90.0 to 90.0 and longitude must be in the range of -180.0 to 180.0 otherwise HTTP Error Code 400 for Bad Request will result.

destination

String

The latitude must be in the range of -90.0 to 90.0 and longitude must be in the range of -180.0 to 180.0 otherwise HTTP Error Code 400 for Bad Request will result.

Optional Parameters

optimize

String

The optimization method for the route.

fastest - Fastest travel time

shortest - Shortest travel distance

easiest - Fewest number of turns

The default is fastest.

vehicle

String

The type of vehicle that will be traveling the route.

car

truck

bicycle

pedestrian

The default is car.

avoid

Sting

Comma separated list of things to avoid.

hov - High Occupancy Vehicle / Car Pool

toll - Toll Road

highway - Limited access highway

uturn - U-Turns

unpaved - Unpaved/dirt roads

ferry - Ferries

none - No avoidances will be considered for route

The default is hov.

traffic_level

String

The available traffic options:

none - The server will not consider real-time traffic information when calculating the route.

avoid - The server will consider real-time traffic information when calculating the route. If historical traffic info is also used, real time data takes precedence.

alert - The server will send traffic notifications to the client.

The default is alert.

Response

Description

  • destination - indicates the place information of destination, it contains:

    • airport

    • areaname

    • city - city name of the returned address.

    • coordinate - contains the latitude and longitude value.

    • country - The country name in long form. For example, "United States".

    • country_code - The ISO 3166-1 three character country code. For example, "USA".

    • formatted_address - The returned address formatted as a single line of text. For example, "25381 Alicia Pky, Laguna Hills, CA 92653, USA".

    • house_number - The house number in the street. For example, "25381" in "25381 Alicia Pky".

    • intersection

    • postal - The postal code.

    • state - state name of the returned address.

    • street - street name of the returned address.

    • type - type of the returned address. The following values are supported:

      • airport

      • street

      • intersection

      • postal

      • city

      • state

      • country

  • maneuver[ ] - is an array indicating the navigation route.

Each maneuver within the array may contain the following fields:

  • bounds - indicates the maneuver bounds. The properties are:

    • maxLat

    • maxLon

    • minLat

    • minLon

  • command - indicates the type of maneuver. See the Maneuver Commands list for details.

  • coordinate - contains the latitude and longitude of the turn.

  • current_road_info` - describes the current road information.

The properties of current road are:

  • primary_name

  • secondary_name

    • distance - indicates the length of the maneuver (in meters).

    • heading - indicates the direction of travel on the current street.

    • is_stack_advise - is a boolean value indicating whether to advise stacking to the next maneuver or not.

    • max_instruction_distance - instructs user to make a maneuver. This prevents user from being told to turn before passing all intermediate streets.

    • segment[ ] - is an array specifies the geometry of the maneuver, which is decoded from the polyline element.

Each segment has the following properties:

  • lat

  • lon

    • speed - estimates travel speed (in meters/second).

    • traffic_region - defines a traffic reporting region present on this maneuver.

The properties of traffic region are:

  • length - indicates the length of the portion of this traffic region which falls within this maneuver.

  • location - is a string uniquely identifies a TMC traffic location.

  • start - indicates the starting point of this traffic region relative to the start of this maneuver.

  • turn_road_info - describes turn road information.

The properties of turn road are:

  • primary_name

  • secondary_name

Turn road contains the following fields:

  • country_info - indicates the country information where the road is located, including country code and driving side.

    • origin indicates - the place information of origin, it contains the same fields as destination.

    • route_extents - contains the extents of the full route. The following elements are include:

      • bottom_right_coordinate - defines the minimum latitude and longitude which bounds the entity described.

      • top_left_coordinate - defines the maximum latitude and longitude which bounds the entity described.

    • route_id - indicates the unique identifier of the route.

    • total_distance - indicates the total distance from orgin to destination, unit as meter.

    • estimated_travel_time - indicates the estimated travel time of the route, unit as second.

    • traffic_flow[ ] - is an array indicating traffic flow data along the route.

The properties of traffic flow are:

  • age - has two optional values: 0 for old data, 1 for new data.

  • type - has three optional values: 0 for historical, 1 for realtime, 2 for no data.

Each traffic flow contains the following list:

  • traffic_flow_item[ ] - Each item has the following properties:

    • color - indicates the status or this traffic region. "R", "Y" or "G" are supported values.

    • free_flow_speed - indicates free flow traffic speed along this traffic region in meters/second.

    • location - is a string uniquely identifies a TMC traffic location.

    • speed - indicates traffic flow speed along this traffic region in meters/second.

JSON

{
  "session_id" : "468-xBHUJ-nbws-NA-NAVTEQ",
  "destination" : {
    "airport" : "",
    "areaname" : "",
    "city" : "Aliso Viejo",
    "coordinate" : {
      "latitude" : 33.574089,
      "longitude" : -117.723328
    },
    "country_code" : "USA",
    "country" : "United States",
    "formatted_address" : "TBD",
    "intersection" : "",
    "postal" : "92656",
    "house_number" : "26756",
    "state" : "California",
    "street" : "Aliso Creek Rd",
    "type" : "street"
  },
  "origin" : {
    "airport" : "",
    "areaname" : "",
    "city" : "Aliso Viejo",
    "coordinate" : {
      "latitude" : 33.559452,
      "longitude" : -117.729485
    },
    "country_code" : "USA",
    "country" : "United States",
    "formatted_address" : "TBD",
    "intersection" : "",
    "postal" : "92656",
    "house_number" : "5",
    "state" : "California",
    "street" : "Liberty",
    "type" : "street"
  },
  "route_extents" : {
    "bottom_right_coordinate" : {
      "latitude" : 33.574089,
      "longitude" : -117.723251
    },
    "top_left_coordinate" : {
      "latitude" : 33.559452,
      "longitude" : -117.730621
    }
  },
  "route_id" : "/n9Ql8KSRXqQ4TgQpwrIjw==",
  "total_distance" : "2413",
  "estimated_travel_time" : "175",
  "maneuvers" : [ {
    "total_length" : 815.7082946652399,
    "bounds" : {
      "minLon" : -117.730396,
      "minLat" : 33.559452,
      "maxLon" : -117.72841,
      "maxLat" : 33.566103
    },
    "command" : "TR.L",
    "coordinate" : {
      "latitude" : 33.566101,
      "longitude" : -117.728409
    },
    "distance" : 813.782,
    "heading" : -88.02203,
    "max_instruction_distance" : 500.0,
    "speed" : 13.75,
    "is_stack_advise" : true,
    "current_road_info" : {
      "secondary_name" : "",
      "primary_name" : "Liberty"
    },
    "segments" : [ {
      "lon" : -117.729488,
      "len" : 2010.9932936550342,
      "lat" : 33.559451,
      "heading" : 340.79857925953746
    }, {
      "lon" : -117.730201,
      "len" : 618.164101223406,
      "lat" : 33.561157,
      "heading" : 347.4326429993422
    }, {
      "lon" : -117.730346,
      "len" : 437.4459997230434,
      "lat" : 33.561699,
      "heading" : 355.98732161263496
    }, {
      "lon" : -117.730379,
      "len" : 572.3762541770561,
      "lat" : 33.562091,
      "heading" : 358.5141524560395
    }, {
      "lon" : -117.730395,
      "len" : 504.544954987564,
      "lat" : 33.562605,
      "heading" : 5.697637738559849
    }, {
      "lon" : -117.730341,
      "len" : 655.5551717109465,
      "lat" : 33.563056,
      "heading" : 10.517296941402583
    }, {
      "lon" : -117.730212,
      "len" : 1078.8524374732933,
      "lat" : 33.563635,
      "heading" : 9.801684874710588
    }, {
      "lon" : -117.730014,
      "len" : 392.35281465253473,
      "lat" : 33.56459,
      "heading" : 23.993618233151924
    }, {
      "lon" : -117.729842,
      "len" : 312.28065662496596,
      "lat" : 33.564912,
      "heading" : 32.72466551949492
    }, {
      "lon" : -117.72966,
      "len" : 351.27967046074735,
      "lat" : 33.565148,
      "heading" : 42.94272423949311
    }, {
      "lon" : -117.729402,
      "len" : 737.6916617031757,
      "lat" : 33.565379,
      "heading" : 49.08635957646945
    }, {
      "lon" : -117.728801,
      "len" : 485.5459302606306,
      "lat" : 33.565813,
      "heading" : 48.327142192827594
    }, {
      "lon" : -117.72841,
      "lat" : 33.566103
    } ],
    "traffic_regions" : [ {
      "start" : 0.0,
      "location" : "std_13",
      "length" : 813.781982421875
    } ],
    "turn_road_info" : {
      "secondary_name" : "",
      "primary_name" : "Aliso Viejo Pkwy",
      "country_info" : {
        "driving_side" : "R",
        "code" : "USA"
      }
    }
  }, {
    "total_length" : 555.1914630705775,
    "bounds" : {
      "minLon" : -117.730621,
      "minLat" : 33.566103,
      "maxLon" : -117.72841,
      "maxLat" : 33.570594
    },
    "command" : "TR.R",
    "coordinate" : {
      "latitude" : 33.570595,
      "longitude" : -117.730621
    },
    "distance" : 554.4198,
    "heading" : 106.47443,
    "max_instruction_distance" : 500.0,
    "speed" : 13.75,
    "is_stack_advise" : false,
    "current_road_info" : {
      "secondary_name" : "",
      "primary_name" : "Aliso Viejo Pkwy"
    },
    "segments" : [ {
      "lon" : -117.72841,
      "len" : 1206.303398428509,
      "lat" : 33.566103,
      "heading" : 320.56997911929165
    }, {
      "lon" : -117.729236,
      "len" : 413.56940512804334,
      "lat" : 33.56694,
      "heading" : 323.8529595546894
    }, {
      "lon" : -117.729499,
      "len" : 604.3853801696679,
      "lat" : 33.56724,
      "heading" : 330.38463420658195
    }, {
      "lon" : -117.729821,
      "len" : 496.7609230644754,
      "lat" : 33.567712,
      "heading" : 334.56704712379724
    }, {
      "lon" : -117.730051,
      "len" : 626.0529447839543,
      "lat" : 33.568115,
      "heading" : 338.98939492299365
    }, {
      "lon" : -117.730293,
      "len" : 307.67811850016375,
      "lat" : 33.56864,
      "heading" : 342.0917363876389
    }, {
      "lon" : -117.730395,
      "len" : 259.5956698678365,
      "lat" : 33.568903,
      "heading" : 345.727272816495
    }, {
      "lon" : -117.730464,
      "len" : 362.38694056118356,
      "lat" : 33.569129,
      "heading" : 350.42326061585965
    }, {
      "lon" : -117.730529,
      "len" : 1275.1818502019412,
      "lat" : 33.56945,
      "heading" : 356.20480655452263
    }, {
      "lon" : -117.73062,
      "lat" : 33.570593
    } ],
    "traffic_regions" : [ {
      "start" : 0.0,
      "location" : "std_13",
      "length" : 554.4198150634766
    } ],
    "turn_road_info" : {
      "secondary_name" : "",
      "primary_name" : "Pacific Park Dr",
      "country_info" : {
        "driving_side" : "R",
        "code" : "USA"
      }
    }
  }, {
    "total_length" : 691.4112160208365,
    "bounds" : {
      "minLon" : -117.730621,
      "minLat" : 33.570539,
      "maxLon" : -117.723255,
      "maxLat" : 33.570884
    },
    "command" : "TR.L",
    "coordinate" : {
      "latitude" : 33.570885,
      "longitude" : -117.723251
    },
    "distance" : 689.6071,
    "heading" : -55.2314,
    "max_instruction_distance" : 189.8698,
    "speed" : 13.85824,
    "is_stack_advise" : false,
    "current_road_info" : {
      "secondary_name" : "",
      "primary_name" : "Pacific Park Dr"
    },
    "segments" : [ {
      "lon" : -117.73062,
      "len" : 145.09715855787948,
      "lat" : 33.570593,
      "heading" : 106.49110763885733
    }, {
      "lon" : -117.73047,
      "len" : 150.52552095358317,
      "lat" : 33.570556,
      "heading" : 97.2224067208406
    }, {
      "lon" : -117.730309,
      "len" : 627.0055058364974,
      "lat" : 33.570539,
      "heading" : 90.0
    }, {
      "lon" : -117.729633,
      "len" : 1727.1512198277396,
      "lat" : 33.570539,
      "heading" : 89.37168373703938
    }, {
      "lon" : -117.727771,
      "len" : 1284.1854184777562,
      "lat" : 33.570556,
      "heading" : 88.41007162680435
    }, {
      "lon" : -117.726387,
      "len" : 522.2378492567146,
      "lat" : 33.570588,
      "heading" : 90.73265168946494
    }, {
      "lon" : -117.725824,
      "len" : 551.8758730294667,
      "lat" : 33.570582,
      "heading" : 90.0
    }, {
      "lon" : -117.725229,
      "len" : 592.8133061484293,
      "lat" : 33.570582,
      "heading" : 88.81623492949204
    }, {
      "lon" : -117.72459,
      "len" : 294.6340894205945,
      "lat" : 33.570593,
      "heading" : 84.14484412246438
    }, {
      "lon" : -117.724274,
      "len" : 257.45702971264564,
      "lat" : 33.57062,
      "heading" : 80.79410948287179
    }, {
      "lon" : -117.724,
      "len" : 116.68418589127941,
      "lat" : 33.570657,
      "heading" : 77.8843043721669
    }, {
      "lon" : -117.723877,
      "len" : 430.0680115117354,
      "lat" : 33.570679,
      "heading" : 79.56081392718988
    }, {
      "lon" : -117.723421,
      "len" : 214.37699158404368,
      "lat" : 33.570749,
      "heading" : 45.90708192044
    }, {
      "lon" : -117.723255,
      "lat" : 33.570883
    } ],
    "traffic_regions" : [ {
      "start" : 0.0,
      "location" : "106N19012",
      "length" : 689.6071147918701
    } ],
    "turn_road_info" : {
      "secondary_name" : "",
      "primary_name" : "Aliso Creek Rd",
      "country_info" : {
        "driving_side" : "R",
        "code" : "USA"
      }
    }
  }, {
    "total_length" : 357.41437487863834,
    "bounds" : {
      "minLon" : -117.723331,
      "minLat" : 33.570884,
      "maxLon" : -117.723255,
      "maxLat" : 33.574092
    },
    "command" : "DT.",
    "coordinate" : {
      "latitude" : 33.574089,
      "longitude" : -117.72332
    },
    "distance" : 355.05652,
    "heading" : 0.0,
    "max_instruction_distance" : 355.05652,
    "speed" : 13.858239,
    "is_stack_advise" : false,
    "current_road_info" : {
      "secondary_name" : "",
      "primary_name" : "Aliso Creek Rd"
    },
    "segments" : [ {
      "lon" : -117.723255,
      "len" : 419.26297263473265,
      "lat" : 33.570883,
      "heading" : 354.6686974576171
    }, {
      "lon" : -117.723297,
      "len" : 442.9982824041159,
      "lat" : 33.571258,
      "heading" : 356.03813458794616
    }, {
      "lon" : -117.72333,
      "len" : 2317.6783391129284,
      "lat" : 33.571655,
      "heading" : 0.0
    }, {
      "lon" : -117.72333,
      "len" : 394.20415463460654,
      "lat" : 33.573737,
      "heading" : 1.4830281794488138
    }, {
      "lon" : -117.723319,
      "lat" : 33.574091
    } ],
    "traffic_regions" : [ {
      "start" : 0.0,
      "location" : "106P19021",
      "length" : 355.05652618408203
    } ]
  } ],
  "traffic_flows" : [ {
    "type" : "0",
    "age" : "1",
    "traffic_flow_items" : [ {
      "speed" : 18.77568,
      "location" : "106N19012",
      "free_flow_speed" : 18.77568,
      "color" : "G"
    }, {
      "speed" : 18.32864,
      "location" : "106P19021",
      "free_flow_speed" : 18.32864,
      "color" : "G"
    } ]
  }, {
    "type" : "1",
    "age" : "1",
    "traffic_flow_items" : [ {
      "speed" : 13.859375,
      "location" : "106P19021",
      "free_flow_speed" : 13.859375,
      "color" : "G"
    } ]
  }, {
    "type" : "2",
    "age" : "1",
    "traffic_flow_items" : [ {
      "speed" : 13.75,
      "location" : "std_13",
      "free_flow_speed" : 13.75,
      "color" : "G"
    } ]
  } ]
}

Test