driving
    • PDF

    driving

    • PDF

    Article Summary

    Overview

    The route search API provides information on the time duration and distance between key locations on the main screen of the map app, along with estimates for fuel costs and toll fares.
    If guidance is needed at a junction on the route, it provides a guide code at the location.

    Requests

    curl "https://naveropenapi.apigw.ntruss.com/map-direction/v1/driving?start={Origin}&goal={Destination}&option={Navigation Options}" \
    	-H "X-NCP-APIGW-API-KEY-ID: {Client ID value issued at application registration}" \
    	-H "X-NCP-APIGW-API-KEY: {Client secret value issued at application registration}" -v
    

    Request parameters

    The following apply universally to the query string parameters of the route search API.

    • If specific information is not available, use meters for the distance unit and milliseconds (1/1000 second) for the time unit.
    • Use UTF-8 for the string encoding.
    ParameterTypeRequiredDescription
    startrequest position formatYOrigin
    goalmultiple request position formatY- Destination
    Information for one or more destinations can be transmitted. When entering multiple destinations, connect them with :
    A route is generated based on the entered destination information with the goal of reaching the destination at the lowest cost
    The maximum number of destinations is 10, and only coordinates within a straight-line distance of 3 km from the initial optimal destination coordinates are considered valid
    waypointsmultiple request position format listN- Waypoints
    Up to 5 waypoints can be entered, and the pipe character (
    optionoption codeN- Navigations options
    Up to 3 options can be requested simultaneously, and multiple options are connected with ":"
    The default value is traoptimal
    cartypecartype codeN- Vehicle type information for toll fare calculation
    The default value is 1
    The weight or size of the vehicle cannot be determined solely based on its type
    For vehicle types 3, 4, and 5, even if the traavoidtoll option is not applied, routes will be searched for by avoiding Hi-pass exclusive tollgates
    General passenger cars are all classified as type 1
    fueltypefueltype codeN- Fuel type for calculating fuel cost
    The default value is gasoline
    mileagedoubleN- Mileage corresponding to the set fuel type
    The parameter used when you want to directly enter the mileage of the vehicle in use
    The default value is 14
    langlang string codeN- Type of language
    The default value is ko

    Request Position Format

    • Strings that connect required items (longitude, latitude) and optional items (name) with , character.
    • The optional items require an appropriate prefix for each item.
    • The optional item values cannot contain characters ,, : or |.
    • URL encoding is required for non-numeric characters.
    • The order between option items does not matter.

    The following are examples using the request position format:

    • Basic example: 127.12345,37.12345
    • Example with added name option items: 127.12345,37.12345,name=출발지이름

    Multiple Request Position Format

    Strings that connect multiple request position format with : character.

    • Each item of waypoints is an independent waypoint, so multiple request position format with name can be used.
      • waypoints Example 1: 127.12345,37.12345:128.12345,38.12345
      • waypoints Example 2: 127.12345,37.12345:128.12345,38.12345,name=장소이름1
      • waypoints Example 3: 127.12345,37.12345,name=장소이름1:128.12345,38.12345,name=장소이름2

    Multiple Request Position Format list

    List strings that connect multiple request position format with | character. The waypoints parameter waypoints uses this format.

    • An example where there are two waypoints, and each waypoint has two coordinates: 127.12345,37.12345:127.23456,37.23456|128.12345,38.12345:128.23456,38.23456

    Cartype Code

    Represents vehicle type information for calculating toll fares.

    CodeDescription
    1Type 1 (Small-sized vehicle) 2-axle vehicle:
    Passenger cars, small-sized vans, and small-sized trucks with a wheel width of 279.4 mm or less
    2Type 2 (Medium-sized vehicle) 2-axle vehicle:
    Medium-sized vans and medium-sized trucks with a wheel width exceeding 279.4 mm and a wheel distance of 1800 mm or less
    3Type 3 (Large-sized vehicle) 2-axle vehicle:
    Large-sized vans with a wheel width exceeding 279.4 mm and a wheel distance exceeding 1800 mm, 2-axle large-sized trucks
    4Type 4 (Large-sized truck) 3-axle large-sized trucks
    5Type 5 (Specialized truck) Specialized trucks with 4 or more axles
    6Type 1 (Compact vehicle) Engine displacement of less than 1000 cc, length of 3.6 m or less, width of 1.6 m or less, and height of 2.0 m or less

    Fueltype Code

    Represents the fuel type used for calculating fuel cost.

    String codeDescription
    gasolineGasoline. Used for calculation of fuel cost
    highgradegasolinePremium gasoline. Used for calculation of fuel cost
    dieselDiesel. Used for calculation of fuel cost
    lpgLPG. Used for calculation of fuel cost

    Option Code

    Represents navigation options. (Since all routes reflect traffic information, even if the origin, destination, and options are the same, the same route is not guaranteed.)

    String codeNavigation type
    trafastReal-time fast route
    tracomfortReal-time comfortable route
    traoptimalReal-time optimal
    traavoidtollAvoid tolls priority
    traavoidcaronlyAvoid motorways priority

    Language Code

    Refers to the supported language types.

    String codeDescription
    koKorean
    enEnglish
    jaJapanese
    zhChinese (Simplified)

    Request Headers

    Header nameDescription
    X-NCP-APIGW-API-KEY-IDClient ID issued upon registering the app
    X-NCP-APIGW-API-KEY-ID:{Client ID}
    X-NCP-APIGW-API-KEYClient secret issued upon registering the app
    X-NCP-APIGW-API-KEY:{Client Secret}

    Request Bodies

    • This API does not require request bodies.

    Responses

    Response Bodies

    The substructure is represented as an object, and the properties of each item in the route are expressed as general key-value pairs ("key": "value").

    PropertyTypeRequiredDescription
    coderesult codeYResponse result code
    messgestringYResponse result strings
    currentDateTimestringYRepresents the time information at the search time. Use the ISO date and time format
    routekey: option code
    value: route unit ent array
    YResponse result

    Route Unit Ent

    Represents the major category of properties for route guidance.

    PropertyTypeRequiredDescription
    summarysummaryYSummary information
    pathlng-lat position format arrayY- All coordinate columns comprising the route
    The coordinates have an index starting from 0
    This index, referred to as pointIndex, is used to convey route information
    sectionsection unitNAn information column on the major roads comprising the route (not encompassing information for all routes)
    guideguide unit for ent arrayNGuide information column

    Summary

    Represents the summary of information on the searched routes.

    PropertyTypeRequiredDescription
    startresponse position formatYOrigin
    goalresponse position formatYDestination
    waypointsresponse position format arrayNWaypoints. Waypoints are recorded in the array in the order of waypoints
    distanceintYTotal route distance (meters)
    durationintYTotal route duration (millisecond (1/1000 second) )
    bboxlng-lat position array with length of 2YThe entire route boundary area. Two arrays of points are provided: the bottom-left point and the top-right point
    tollFareintYToll fares (Tollgate)
    taxiFareintYTaxi fares (Considering each local government, midnight, city border, combination, and call fare)
    fuelPriceintYFuel cost considering the nationwide average fuel cost and mileage at the given point in time

    Section Unit

    Represents the information on the major roads among searched routes. Information on the route with a long driving distance based on the road name.

    PropertyTypeRequiredDescription
    pointIndexintYAn index of coordinates comprising the route
    pointCountintYNumber of feature points
    distanceintYDistance (meters)
    namestringYRoad name
    congestioncongestion codeNSection congestion
    speedintNAverage speed (km/h)

    Guide Unit for Ent

    Provides the information on the location requiring turn guidance and the distance to the turn guidance.

    PropertyTypeRequiredDescription
    pointIndexintYAn index of coordinates comprising the route
    typeguide codeYGuide type
    instructionsstringNGuide message
    distanceintYThe distance (in meters) from the route coordinate index of the previous guide unit to the route coordinate index of the corresponding guide unit
    durationintYTime duration (in milliseconds (1/1000 second)) from the route coordinate index of the previous guide unit to the route coordinate index of the corresponding guide unit

    Result Code

    If the ResultCode is not 0, the navigation fails.

    HttpStatusCodeResultCodeResultMessageDescription
    2000-Route search successful
    2001-The origin and the destination are the same
    2002-In the case where the origin and the destination are not the surrounding area of the road
    2003-Unable to provide vehicle route search results
    2004-Where the waypoints are not around roads
    2005-When the requested route is very long (When the sum of the straight-line distance, including waypoints, is 1500 km or more)

    lng-lat Position Format

    Represents the coordinate information in longitude and latitude. A one-dimensional array with a length of 2. This is provided in the order of longitude and latitude (lng, lat).

    E.g., [127.001122, 37.001122]

    Response Position Format

    Provides the coordinate information in origin, destination, and waypoints.

    PropertyTypeRequiredDescription
    locationlng-lat positionYLocations
    dirview direction codeNThe direction facing the location coordinates on the route. It can only exist for waypoints and destination
    distanceintNThe distance (in meters) from the origin or previous waypoint to the location. In the case where there are waypoints, it exists only for waypoints and destination
    durationintNTime duration (in milliseconds (1/1000 second)) from the origin or the previous waypoint to the location. In the case where there are waypoints, it exists only for waypoints and destination
    pointIndexintNThe index of the coordinates corresponding to the location on the route. In the case where there are waypoints, it exists only for waypoints and destination

    View Direction Code

    Represents the direction of the locations specified as the actual destination/waypoints from the destination/waypoints on the route. Specifies the direction based on the moving direction on the route.

    CodeDescription
    0Front
    1Left
    2Right

    Guide Code

    Guidance on how to proceed at locations where a turn occurs on the route or additional guidances are needed.

    CodeDescription
    1Straight direction
    2Turn left
    3Turn right
    4Left direction
    5Right direction
    6U-turn
    8Unprotected left turn
    11Left 8 o'clock direction
    12Left 9 o'clock direction
    13Left 11 o'clock direction
    14Right 1 o'clock direction
    15Right 3 o'clock direction
    16Right 4 o'clock direction
    21Straight direction from the rotary
    22U-turn at the rotary
    23Left 7 o'clock direction from the rotary
    24Left 8 o'clock direction from the rotary
    25Left 9 o'clock direction from the rotary
    26Left 10 o'clock direction from the rotary
    27Left 11 o'clock direction from the rotary
    2812 o'clock direction from the rotary
    29Right 1 o'clock direction from the rotary
    30Right 2 o'clock direction from the rotary
    31Right 3 o'clock direction from the rotary
    32Right 4 o'clock direction from the rotary
    33Right 5 o'clock direction from the rotary
    346 o'clock direction from the rotary
    41Enter the road on the left
    42Enter the road on the right
    47Enter the rest area
    48Enter ferry route
    49Exit ferry route
    50Enter the highway ahead
    51Exit the highway ahead
    52Enter the urban highway ahead
    53Exit the urban highway ahead
    54Enter the branch road ahead
    55Enter the overpass ahead
    56Enter the underpass ahead
    57Enter the highway on the left
    58Exit the highway on the left
    59Enter the urban highway on the left
    60Exit the urban highway on the left
    62Enter the overpass on the left
    63The side road of the overpass on the left
    64Enter the underpass on the left
    65The side road of the underpass on the left
    66Enter the highway on the right
    67Exit the highway on the right
    68Enter the urban highway on the right
    69Exit the urban highway on the right
    71Enter the overpass on the right
    72The side road of the overpass on the right
    73Enter the underpass on the right
    74The side road of the underpass on the right
    75Enter the motorway ahead
    76Enter the motorway on the left
    77Enter the motorway on the right
    78Exit the motorway ahead
    79Exit the motorway on the left
    80Exit the motorway on the right
    81Join the main line on the left
    82Join the main line on the right
    87Waypoints
    88Destination
    91Straight direction from the rotary
    92U-turn at the rotary
    93Left 7 o'clock direction from the rotary
    94Left 8 o'clock direction from the rotary
    95Left 9 o'clock direction from the rotary
    96Left 10 o'clock direction from the rotary
    97Left 11 o'clock direction from the rotary
    9812 o'clock direction from the rotary
    99Right 1 o'clock direction from the rotary
    100Right 2 o'clock direction from the rotary
    101Right 3 o'clock direction from the rotary
    102Right 4 o'clock direction from the rotary
    103Right 5 o'clock direction from the rotary
    1046 o'clock direction from the rotary
    121Tollgate
    122Exclusive tollgate for High-pass
    123One tolling tollgate

    Congestion code

    Represents a classification code for congestion estimated using the information on road type and actual travel speed.

    CodeDescription
    0No data
    1Going smoothly
    2Going slowly
    3Congested

    The following is the table representing travel speed for each road type based on congestion:

    (km/h)General roadNational roadUrban highwayHighway
    Going smoothlyOver 30Over 40Over 60Over 70
    Going slowly15 ~ 3020 ~ 4030 ~ 6040 ~ 70
    CongestedUnder 15Under 20Under 30Under 40

    Examples

    Request Examples

    curl "https://naveropenapi.apigw.ntruss.com/map-direction/v1/driving?start=127.1058342,37.359708&goal=129.075986,35.179470&option=trafast" \
    	-H "X-NCP-APIGW-API-KEY-ID: {Client ID value issued at application registration}" \
    	-H "X-NCP-APIGW-API-KEY: {Client secret value issued at application registration}" -v
    

    Response Examples

    {
        "code": 0,
        "message": "The route search was successful.",
        "currentDateTime": "2018-12-21T14:45:34",
        "route": {
            "trafast": [
                {
                    "summary": {
                        "start": {
                            "location": [
                                127.1058342,
                                37.3597078
                            ]
                        },
                        "goal": {
                            "location": [
                                129.0759853,
                                35.1794697
                            ],
                            "dir": 2
                        },
                        "distance": 382403,
                        "duration": 15372873,
                        "bbox": [
                            [
                                127.0833901,
                                35.1793188
                            ],
                            [
                                129.0817364,
                                37.3599059
                            ]
                        ],
                        "tollFare": 24500,
                        "taxiFare": 319900,
                        "fuelPrice": 46027
                    },
                    "path": [
                        [
                            127.1059968,
                            37.3597093
                        ],
    
                        ....
    
                        [
                            129.0764276,
                            35.1795108
                        ],
                        [
                            129.0762855,
                            35.1793188
                        ]
                    ],
                    "section": [
                        {
                            "pointIndex": 654,
                            "pointCount": 358,
                            "distance": 22495,
                            "name": "Jukyang-daero",
                            "congestion": 1,
                            "speed": 60
                        },
                        {
                            "pointIndex": 3059,
                            "pointCount": 565,
                            "distance": 59030,
                            "name": "Nakdong-daero",
                            "congestion": 1,
                            "speed": 89
                        },
                        {
                            "pointIndex": 4708,
                            "pointCount": 433,
                            "distance": 23385,
                            "name": "Saemaeul-ro",
                            "congestion": 1,
                            "speed": 66
                        }
                    ],
                    "guide": [
                        {
                            "pointIndex": 1,
                            "type": 3,
                            "instructions": "Turn right from Jeongjail-ro 1 intersection towards Seongnam-daero",
                            "distance": 21,
                            "duration": 4725
                        },
                        {
                            "pointIndex": 8,
                            "type": 3,
                            "instructions": "Turn right from Buljeonggyo Intersection towards Suwon·Yongin, Migeum Subway Station",
                            "distance": 186,
                            "duration": 42914
                        },
    
     					....
    
                        {
                            "pointIndex": 6824,
                            "type": 14,
                            "instructions": "From Yeonsan Intersection, turn right 1 o’clock toward Seomyeon Intersection, City Hall/National Police Agency",
                            "distance": 910,
                            "duration": 125240
                        },
                        {
                            "pointIndex": 6842,
                            "type": 88,
                            "instructions": "Destination",
                            "distance": 895,
                            "duration": 111333
                        }
                    ]
                }
            ]
        }
    }
    

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.