경로 계산 (경로 재탐색 포함)은 탐색하는 데 가장 적은 시간이 걸리는 경로를 기본 최적 경로로 반환합니다. 하지만 경로 대안 중 더 짧은 경로가 반환되도록 라우팅 전략을 변경할 수 있습니다.
더 짧은 경로는 Google의 기본 비용 모델을 기반으로 최적 경로 중 가장 짧은 경로를 의미합니다. 이 옵션이 적절하지 않은 대안일 수 있으므로 더 짧은 경로가 절대적으로 가장 짧은 경로가 아닐 수 있습니다. 예를 들어 절대 최단 경로가 10km이고 탐색하는 데 50분이 걸리고 다른 경로가 15km이지만 탐색하는 데 20분만 걸린다면 두 번째 선택이 최적입니다. 5km를 줄이기 위해 30분을 소비하는 것은 좋은 절충안이 아니기 때문입니다.
여행의 라우팅 전략을 설정하면 여행이 완료될 때까지 변경되지 않습니다. 기존 여행의 경로 지정 전략을 변경하려면 목적지를 지우고 새 경로 지정 전략으로 다시 설정해야 합니다.
경로 세부정보 가져오기
특정 경유지에 가장 적합한 경로 전략을 확인하려면 getRouteInfo()를 호출하여 기본 최적 경로와 절대 최단 경로의 경로 세부정보를 모두 가져옵니다. 세부정보에는 목적지 경유지까지의 소요 시간과 거리가 포함됩니다.
이러한 세부정보는 RouteInfo에서 가져오며 ListenableResultFuture에 반환됩니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eBy default, the Navigation SDK calculates the fastest route, but you can configure it to prioritize the shortest route instead for rideshare or taxi-like services.\u003c/p\u003e\n"],["\u003cp\u003eTo determine the optimal route strategy, use \u003ccode\u003egetRouteInfo()\u003c/code\u003e to compare route details like duration and distance for both default and shorter route options.\u003c/p\u003e\n"],["\u003cp\u003eSet the desired routing strategy (default or shorter) using \u003ccode\u003eRoutingOptions\u003c/code\u003e when setting destinations with \u003ccode\u003esetDestinations()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can customize route callouts to display either time remaining or distance remaining, regardless of the chosen routing strategy, using \u003ccode\u003esetRouteCalloutInfoFormat\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhile the SDK avoids ferries by default, you can include them in route calculations by setting \u003ccode\u003eavoidFerries\u003c/code\u003e to \u003ccode\u003efalse\u003c/code\u003e in \u003ccode\u003eRoutingOptions\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["Route calculations (including rerouting) return the route that takes the\nleast amount of time to navigate as the *default best route*. But\nyou can change the routing strategy so that the shorter of the route\nalternatives is returned instead.\n\nThe term *shorter* means the route that is the shortest among optimal routes\nbased on our default cost model. The shorter route might not be the *absolute*\nshortest route, since that option might be a poor alternative. For example, if\nthe absolute shortest route is 10 km and takes 50 minutes to navigate and\nanother route is 15 km, but only takes 20 minutes to navigate, the second choice\nis optimal, because spending 30 mins to reduce five km isn't a good trade-off.\n\nOnce you set the routing strategy for a trip, it won't change until the trip\ncompletes. To change the routing strategy for an existing trip, you must clear\nthe destinations and reset them again with the new routing strategy.\n| **Note:** This feature is intended for rideshare providers that operate in regulated markets (such as Europe), who are often required by law to price their services based on the same principles as traditional taxis---which charge based primarily on the distance traveled.\n\nGetting route details\n\nTo determine which route strategy is the optimal choice for a given\nwaypoint, call `getRouteInfo()` to get route details for both the\ndefault best route and the absolute shorter route. Details include the duration\nand the distance to a destination waypoint.\n\nThese details come from `RouteInfo`, and are returned in a\n`ListenableResultFuture`.\n\nExample\n\nThe following code example demonstrates how to get route details for each of the\ntwo routing strategies. \n\n ListenableResultFuture\u003cRouteInfo\u003e routeInfoFuture =\n navigator.getRouteInfo(waypoint, routingOptions);\n\nSetting the routing strategy\n\nYou can configure the routing strategy by setting\n`RoutingOptions.routingStrategy` when you call `setDestinations()`.\n\n`RoutingOptions.routingStrategy` takes one of the following enumeration\nvalues:\n\n| Enumeration Value | Description |\n|------------------------------|------------------------------------------------------------------------------------------------|\n| RoutingStrategy.DEFAULT_BEST | Ranks routes by the Navigation SDK's default cost model. This is the default routing strategy. |\n| RoutingStrategy.SHORTER | Ranks routes by distance. The highest ranking route is the shortest of those returned. |\n\n| **Warning:** This feature is incompatible with the [Hiding Alternate Route](/maps/documentation/navigation/android-sdk/controls#hiding_alternate_routes) feature. Using these two features at the same time will produce unexpected results.\n\nExample\n\nThe following code example demonstrates how to set the shorter route preference. \n\n RoutingOptions routingOptions = new RoutingOptions();\n routingOptions.routingStrategy(RoutingStrategy.SHORTER);\n navigator.setDestinations(destinations, routingOptions, displayOptions);\n\nRoutes that include ferries\n\nBy default, the NavSDK excludes routes that include ferries. If\nyou prefer to include ferry options as part of your routes, you can adjust\nthis routing preference to expose the trip to ferry segments by setting\n`avoidFerries` to `false`.\n\nExample \n\n RoutingOptions routingOptions = new RoutingOptions().avoidFerries(true);\n // Add additional routing preferences\n navigator.setDestination(destination, routingOptions);\n\nThe route callout format\n\nUnder the shorter route preference, callouts along the route display\ndistance details. But you can use the ETA callouts instead.\n\nConfiguring the route callout format\n\nYou can change the route callout format by calling `setRouteCalloutInfoFormat`\nin `NavigationView` (or in `NavigationFragment`). `setRouteCalloutInfoFormat`\ntakes one of the following enumeration values:\n\n| Enumeration Value | Description |\n|---------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|\n| RouteCalloutInfoFormat.DEFAULT | Displays time remaining when using the default best route routing strategy. Displays distance remaining when using the shorter route routing strategy. |\n| RouteCalloutInfoFormat.TIME | Displays time remaining. |\n| RouteCalloutInfoFormat.DISTANCE | Displays distance remaining. |\n\nExample\n\nThe following code example demonstrates how to configure the route callout\nformat. \n\n mNavFragment.setRouteCalloutInfoFormat(RouteCalloutInfoFormat.TIME);"]]