Directions

Request

The Directions API is used to get the set of maneuvers between two different geographic coordinates (latitude/longitude).

GET https://apis.location.studio/geo/v2/directions/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.

Response

Description

When the service returns results from a directions request, it places them within a few elements and two arrays.

The results contain the following elements:

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).

    • turn_road_info - describes turn road information. The properties of turn road are:

      • primary_name

      • secondary_name

        Turn road contains the following field:
    • 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.

JSON

{
  "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.723084
    },
    "top_left_coordinate" : {
      "latitude" : 33.558479,
      "longitude" : -117.729485
    }
  },
  "route_id" : "VGvRa3Q5QBmXQ6tTqw+95A==",
  "total_distance" : "2129",
  "estimated_travel_time" : "150",
  "maneuvers" : [ {
    "total_length" : 468.75064299608323,
    "bounds" : {
      "minLon" : -117.729489,
      "minLat" : 33.558481,
      "maxLon" : -117.725315,
      "maxLat" : 33.55957
    },
    "command" : "TR.L",
    "coordinate" : {
      "latitude" : 33.55957,
      "longitude" : -117.725311
    },
    "distance" : 467.45944,
    "heading" : -84.933945,
    "max_instruction_distance" : 467.45944,
    "speed" : 13.367753,
    "is_stack_advise" : false,
    "current_road_info" : {
      "secondary_name" : "",
      "primary_name" : "Liberty"
    },
    "segments" : [ {
      "lon" : -117.729488,
      "len" : 103.71257893775405,
      "lat" : 33.559451,
      "heading" : 157.3806172974525
    }, {
      "lon" : -117.729445,
      "len" : 304.51868421085726,
      "lat" : 33.559365,
      "heading" : 149.62346564663758
    }, {
      "lon" : -117.729279,
      "len" : 286.3058974841453,
      "lat" : 33.559129,
      "heading" : 138.62597511463272
    }, {
      "lon" : -117.729075,
      "len" : 340.83627619384515,
      "lat" : 33.558936,
      "heading" : 127.88086689489802
    }, {
      "lon" : -117.728785,
      "len" : 383.0261344114313,
      "lat" : 33.558748,
      "heading" : 114.74049104357937
    }, {
      "lon" : -117.72841,
      "len" : 255.75627220001618,
      "lat" : 33.558604,
      "heading" : 110.64381181122553
    }, {
      "lon" : -117.728152,
      "len" : 282.38233033087545,
      "lat" : 33.558523,
      "heading" : 99.7594304143617
    }, {
      "lon" : -117.727852,
      "len" : 269.01921714534956,
      "lat" : 33.55848,
      "heading" : 90.0
    }, {
      "lon" : -117.727562,
      "len" : 184.53673559670818,
      "lat" : 33.55848,
      "heading" : 84.46123265937919
    }, {
      "lon" : -117.727364,
      "len" : 195.20108511460387,
      "lat" : 33.558496,
      "heading" : 75.80501554419918
    }, {
      "lon" : -117.72716,
      "len" : 427.3903595178566,
      "lat" : 33.558539,
      "heading" : 68.61386086926568
    }, {
      "lon" : -117.726731,
      "len" : 382.0659123882303,
      "lat" : 33.558679,
      "heading" : 51.426529280702724
    }, {
      "lon" : -117.726409,
      "len" : 411.047925459599,
      "lat" : 33.558893,
      "heading" : 45.67596298831459
    }, {
      "lon" : -117.726092,
      "len" : 297.983874564835,
      "lat" : 33.559151,
      "heading" : 51.67377841204697
    }, {
      "lon" : -117.72584,
      "len" : 396.3131000369706,
      "lat" : 33.559317,
      "heading" : 57.17217738480266
    }, {
      "lon" : -117.725481,
      "len" : 167.41004636775403,
      "lat" : 33.55951,
      "heading" : 66.9008805796961
    }, {
      "lon" : -117.725315,
      "lat" : 33.559569
    } ],
    "turn_road_info" : {
      "secondary_name" : "",
      "primary_name" : "Aliso Creek Rd",
      "country_info" : {
        "driving_side" : "R",
        "code" : "USA"
      }
    }
  }, {
    "total_length" : 1667.2795388928812,
    "bounds" : {
      "minLon" : -117.725739,
      "minLat" : 33.55957,
      "maxLon" : -117.723084,
      "maxLat" : 33.574092
    },
    "command" : "DT.",
    "coordinate" : {
      "latitude" : 33.574089,
      "longitude" : -117.72332
    },
    "distance" : 1661.3607,
    "heading" : 0.0,
    "max_instruction_distance" : 500.0,
    "speed" : 14.444443,
    "is_stack_advise" : false,
    "current_road_info" : {
      "secondary_name" : "",
      "primary_name" : "Aliso Creek Rd"
    },
    "segments" : [ {
      "lon" : -117.725315,
      "len" : 352.4988774327803,
      "lat" : 33.559569,
      "heading" : 341.908868455197
    }, {
      "lon" : -117.725433,
      "len" : 380.1173380406735,
      "lat" : 33.55987,
      "heading" : 343.2637859114052
    }, {
      "lon" : -117.725551,
      "len" : 329.1115349535048,
      "lat" : 33.560197,
      "heading" : 348.7854881149887
    }, {
      "lon" : -117.72562,
      "len" : 165.18873038757755,
      "lat" : 33.560487,
      "heading" : 346.0267041785762
    }, {
      "lon" : -117.725663,
      "len" : 289.360191603723,
      "lat" : 33.560631,
      "heading" : 353.00285792172514
    }, {
      "lon" : -117.725701,
      "len" : 298.972385132867,
      "lat" : 33.560889,
      "heading" : 356.26414106880287
    }, {
      "lon" : -117.725722,
      "len" : 102.38252431424857,
      "lat" : 33.561157,
      "heading" : 351.66470161300805
    }, {
      "lon" : -117.725738,
      "len" : 818.2137121630401,
      "lat" : 33.561248,
      "heading" : 0.3247849530578119
    }, {
      "lon" : -117.725733,
      "len" : 344.3018698255877,
      "lat" : 33.561983,
      "heading" : 8.365410346276171
    }, {
      "lon" : -117.725679,
      "len" : 533.8804623734327,
      "lat" : 33.562289,
      "heading" : 10.208045189629026
    }, {
      "lon" : -117.725577,
      "len" : 381.24094481950226,
      "lat" : 33.562761,
      "heading" : 13.507874675940073
    }, {
      "lon" : -117.725481,
      "len" : 376.4524210686002,
      "lat" : 33.563094,
      "heading" : 17.79082395044873
    }, {
      "lon" : -117.725357,
      "len" : 561.6766570529318,
      "lat" : 33.563416,
      "heading" : 20.696361113228416
    }, {
      "lon" : -117.725143,
      "len" : 912.8389342818434,
      "lat" : 33.563888,
      "heading" : 25.52151500985232
    }, {
      "lon" : -117.724719,
      "len" : 1613.6896701088028,
      "lat" : 33.564628,
      "heading" : 24.41177903239651
    }, {
      "lon" : -117.724,
      "len" : 890.2391933158771,
      "lat" : 33.565948,
      "heading" : 23.38915929794086
    }, {
      "lon" : -117.723619,
      "len" : 352.79668759311687,
      "lat" : 33.566682,
      "heading" : 21.43553344956896
    }, {
      "lon" : -117.72348,
      "len" : 515.6131264790209,
      "lat" : 33.566977,
      "heading" : 15.654794143753854
    }, {
      "lon" : -117.72333,
      "len" : 258.74844633920577,
      "lat" : 33.567423,
      "heading" : 14.532787703710142
    }, {
      "lon" : -117.72326,
      "len" : 303.3148579487307,
      "lat" : 33.567648,
      "heading" : 10.394502881730705
    }, {
      "lon" : -117.723201,
      "len" : 663.5661208466099,
      "lat" : 33.567916,
      "heading" : 8.197019920680535
    }, {
      "lon" : -117.723099,
      "len" : 280.9181937023327,
      "lat" : 33.568506,
      "heading" : 3.0282978260884312
    }, {
      "lon" : -117.723083,
      "len" : 663.4660375062821,
      "lat" : 33.568758,
      "heading" : 0.0
    }, {
      "lon" : -117.723083,
      "len" : 694.2183835570028,
      "lat" : 33.569354,
      "heading" : 355.862621342814
    }, {
      "lon" : -117.723137,
      "len" : 396.5790888051563,
      "lat" : 33.569976,
      "heading" : 353.55420853982025
    }, {
      "lon" : -117.723185,
      "len" : 222.02294521429224,
      "lat" : 33.57033,
      "heading" : 356.1674009645236
    }, {
      "lon" : -117.723201,
      "len" : 397.2423052756853,
      "lat" : 33.570529,
      "heading" : 352.7566199025936
    }, {
      "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
    } ]
  } ] }

Test