- Print
- PDF
driving
- Print
- PDF
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.
Parameter | Type | Required | Description |
---|---|---|---|
start | request position format | Y | Origin |
goal | multiple request position format | Y | - 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 |
waypoints | multiple request position format list | N | - Waypoints Up to 5 waypoints can be entered, and the pipe character ( |
option | option code | N | - Navigations options Up to 3 options can be requested simultaneously, and multiple options are connected with ":" The default value is traoptimal |
cartype | cartype code | N | - 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 |
fueltype | fueltype code | N | - Fuel type for calculating fuel cost The default value is gasoline |
mileage | double | N | - 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 |
lang | lang string code | N | - 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.
Code | Description |
---|---|
1 | Type 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 |
2 | Type 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 |
3 | Type 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 |
4 | Type 4 (Large-sized truck) 3-axle large-sized trucks |
5 | Type 5 (Specialized truck) Specialized trucks with 4 or more axles |
6 | Type 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 code | Description |
---|---|
gasoline | Gasoline. Used for calculation of fuel cost |
highgradegasoline | Premium gasoline. Used for calculation of fuel cost |
diesel | Diesel. Used for calculation of fuel cost |
lpg | LPG. 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 code | Navigation type |
---|---|
trafast | Real-time fast route |
tracomfort | Real-time comfortable route |
traoptimal | Real-time optimal |
traavoidtoll | Avoid tolls priority |
traavoidcaronly | Avoid motorways priority |
Language Code
Refers to the supported language types.
String code | Description |
---|---|
ko | Korean |
en | English |
ja | Japanese |
zh | Chinese (Simplified) |
Request Headers
Header name | Description |
---|---|
X-NCP-APIGW-API-KEY-ID | Client ID issued upon registering the appX-NCP-APIGW-API-KEY-ID:{Client ID} |
X-NCP-APIGW-API-KEY | Client secret issued upon registering the appX-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"
).
Property | Type | Required | Description |
---|---|---|---|
code | result code | Y | Response result code |
messge | string | Y | Response result strings |
currentDateTime | string | Y | Represents the time information at the search time. Use the ISO date and time format |
route | key: option code value: route unit ent array | Y | Response result |
Route Unit Ent
Represents the major category of properties for route guidance.
Property | Type | Required | Description |
---|---|---|---|
summary | summary | Y | Summary information |
path | lng-lat position format array | Y | - 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 |
section | section unit | N | An information column on the major roads comprising the route (not encompassing information for all routes) |
guide | guide unit for ent array | N | Guide information column |
Summary
Represents the summary of information on the searched routes.
Property | Type | Required | Description |
---|---|---|---|
start | response position format | Y | Origin |
goal | response position format | Y | Destination |
waypoints | response position format array | N | Waypoints. Waypoints are recorded in the array in the order of waypoints |
distance | int | Y | Total route distance (meters) |
duration | int | Y | Total route duration (millisecond (1/1000 second) ) |
bbox | lng-lat position array with length of 2 | Y | The entire route boundary area. Two arrays of points are provided: the bottom-left point and the top-right point |
tollFare | int | Y | Toll fares (Tollgate) |
taxiFare | int | Y | Taxi fares (Considering each local government, midnight, city border, combination, and call fare) |
fuelPrice | int | Y | Fuel 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.
Property | Type | Required | Description |
---|---|---|---|
pointIndex | int | Y | An index of coordinates comprising the route |
pointCount | int | Y | Number of feature points |
distance | int | Y | Distance (meters) |
name | string | Y | Road name |
congestion | congestion code | N | Section congestion |
speed | int | N | Average speed (km/h) |
Guide Unit for Ent
Provides the information on the location requiring turn guidance and the distance to the turn guidance.
Property | Type | Required | Description |
---|---|---|---|
pointIndex | int | Y | An index of coordinates comprising the route |
type | guide code | Y | Guide type |
instructions | string | N | Guide message |
distance | int | Y | The distance (in meters) from the route coordinate index of the previous guide unit to the route coordinate index of the corresponding guide unit |
duration | int | Y | Time 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.
HttpStatusCode | ResultCode | ResultMessage | Description |
---|---|---|---|
200 | 0 | - | Route search successful |
200 | 1 | - | The origin and the destination are the same |
200 | 2 | - | In the case where the origin and the destination are not the surrounding area of the road |
200 | 3 | - | Unable to provide vehicle route search results |
200 | 4 | - | Where the waypoints are not around roads |
200 | 5 | - | 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.
Property | Type | Required | Description |
---|---|---|---|
location | lng-lat position | Y | Locations |
dir | view direction code | N | The direction facing the location coordinates on the route. It can only exist for waypoints and destination |
distance | int | N | The 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 |
duration | int | N | Time 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 |
pointIndex | int | N | The 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.
Code | Description |
---|---|
0 | Front |
1 | Left |
2 | Right |
Guide Code
Guidance on how to proceed at locations where a turn occurs on the route or additional guidances are needed.
Code | Description |
---|---|
1 | Straight direction |
2 | Turn left |
3 | Turn right |
4 | Left direction |
5 | Right direction |
6 | U-turn |
8 | Unprotected left turn |
11 | Left 8 o'clock direction |
12 | Left 9 o'clock direction |
13 | Left 11 o'clock direction |
14 | Right 1 o'clock direction |
15 | Right 3 o'clock direction |
16 | Right 4 o'clock direction |
21 | Straight direction from the rotary |
22 | U-turn at the rotary |
23 | Left 7 o'clock direction from the rotary |
24 | Left 8 o'clock direction from the rotary |
25 | Left 9 o'clock direction from the rotary |
26 | Left 10 o'clock direction from the rotary |
27 | Left 11 o'clock direction from the rotary |
28 | 12 o'clock direction from the rotary |
29 | Right 1 o'clock direction from the rotary |
30 | Right 2 o'clock direction from the rotary |
31 | Right 3 o'clock direction from the rotary |
32 | Right 4 o'clock direction from the rotary |
33 | Right 5 o'clock direction from the rotary |
34 | 6 o'clock direction from the rotary |
41 | Enter the road on the left |
42 | Enter the road on the right |
47 | Enter the rest area |
48 | Enter ferry route |
49 | Exit ferry route |
50 | Enter the highway ahead |
51 | Exit the highway ahead |
52 | Enter the urban highway ahead |
53 | Exit the urban highway ahead |
54 | Enter the branch road ahead |
55 | Enter the overpass ahead |
56 | Enter the underpass ahead |
57 | Enter the highway on the left |
58 | Exit the highway on the left |
59 | Enter the urban highway on the left |
60 | Exit the urban highway on the left |
62 | Enter the overpass on the left |
63 | The side road of the overpass on the left |
64 | Enter the underpass on the left |
65 | The side road of the underpass on the left |
66 | Enter the highway on the right |
67 | Exit the highway on the right |
68 | Enter the urban highway on the right |
69 | Exit the urban highway on the right |
71 | Enter the overpass on the right |
72 | The side road of the overpass on the right |
73 | Enter the underpass on the right |
74 | The side road of the underpass on the right |
75 | Enter the motorway ahead |
76 | Enter the motorway on the left |
77 | Enter the motorway on the right |
78 | Exit the motorway ahead |
79 | Exit the motorway on the left |
80 | Exit the motorway on the right |
81 | Join the main line on the left |
82 | Join the main line on the right |
87 | Waypoints |
88 | Destination |
91 | Straight direction from the rotary |
92 | U-turn at the rotary |
93 | Left 7 o'clock direction from the rotary |
94 | Left 8 o'clock direction from the rotary |
95 | Left 9 o'clock direction from the rotary |
96 | Left 10 o'clock direction from the rotary |
97 | Left 11 o'clock direction from the rotary |
98 | 12 o'clock direction from the rotary |
99 | Right 1 o'clock direction from the rotary |
100 | Right 2 o'clock direction from the rotary |
101 | Right 3 o'clock direction from the rotary |
102 | Right 4 o'clock direction from the rotary |
103 | Right 5 o'clock direction from the rotary |
104 | 6 o'clock direction from the rotary |
121 | Tollgate |
122 | Exclusive tollgate for High-pass |
123 | One tolling tollgate |
Congestion code
Represents a classification code for congestion estimated using the information on road type and actual travel speed.
Code | Description |
---|---|
0 | No data |
1 | Going smoothly |
2 | Going slowly |
3 | Congested |
The following is the table representing travel speed for each road type based on congestion:
(km/h) | General road | National road | Urban highway | Highway |
---|---|---|---|---|
Going smoothly | Over 30 | Over 40 | Over 60 | Over 70 |
Going slowly | 15 ~ 30 | 20 ~ 40 | 30 ~ 60 | 40 ~ 70 |
Congested | Under 15 | Under 20 | Under 30 | Under 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
}
]
}
]
}
}