경로 계산 (경로 재탐색 포함)은 탐색하는 데 가장 적은 시간이 걸리는 경로를 기본 최적 경로로 반환합니다. 하지만 경로 대안 중 더 짧은 경로가 반환되도록 라우팅 전략을 변경할 수 있습니다.
더 짧은 경로는 Google의 기본 비용 모델을 기반으로 최적 경로 중 가장 짧은 경로를 의미합니다. 이 옵션이 적절하지 않을 수 있으므로 더 짧은 경로가 절대적으로 가장 짧은 경로가 아닐 수 있습니다. 예를 들어 절대 최단 경로가 10km이고 탐색하는 데 50분이 걸리고 다른 경로가 15km이지만 탐색하는 데 20분만 걸린다면 두 번째 선택이 최적입니다. 5km를 줄이기 위해 30분을 소비하는 것은 좋은 절충안이 아니기 때문입니다.
여행의 라우팅 전략을 설정하면 여행이 완료될 때까지 변경되지 않습니다. 기존 여행의 경로 지정 전략을 변경하려면 목적지를 지우고 새 경로 지정 전략으로 다시 설정해야 합니다.
경로 세부정보 가져오기
특정 경유지에 가장 적합한 경로 전략을 확인하려면 getRouteInfoForDestination()를 호출하여 기본 최적 경로와 절대 최단 경로의 경로 세부정보를 모두 가져옵니다. 세부정보에는 기간과 목적지 경유지까지의 거리가 포함됩니다.
[[["이해하기 쉬움","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\u003eThe Navigation SDK offers two routing strategies: the default best route (prioritizes time) and the shorter route (prioritizes distance among optimal routes).\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve route details using \u003ccode\u003egetRouteInfoForDestination()\u003c/code\u003e to compare the default best route and the shorter route.\u003c/p\u003e\n"],["\u003cp\u003eCustomize routing strategy with \u003ccode\u003eGMSNavigationRoutingOptions\u003c/code\u003e, including ferry inclusion with \u003ccode\u003eavoidsFerries\u003c/code\u003e and route callout format with \u003ccode\u003erouteCalloutFormat\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eTo change an active trip's routing strategy, you must clear existing destinations and re-set them with the desired strategy.\u003c/p\u003e\n"],["\u003cp\u003eThe shorter route strategy is designed for Rideshare providers operating in regulated markets where pricing is primarily based on distance traveled.\u003c/p\u003e\n"]]],[],null,["# Adjust routing preferences\n\nRoute 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 route\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:** The feature mentioned above 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---------------------\n\nTo determine which route strategy is the optimal choice for a given waypoint,\ncall `getRouteInfoForDestination()` to get route details for both the default\nbest route and the absolute shorter route. Details include the duration and the\ndistance to a destination waypoint.\n\nThese details come from\n[`GMSNavigationRouteInfo`](/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSNavigationRouteInfo)\nin the callback.\n\n### Example\n\nThe following code example demonstrates how to get route details for each of the\ntwo routing strategies.\n\n\u003cbr /\u003e\n\n### Swift\n\n\u003cbr /\u003e\n\n let routingOptions = GMSNavigationRoutingOptions()\n navigator?.getRouteInfoForDestination(destination,\n routingOptions: routingOptions) { routeInfo in\n ...\n }\n\n\u003cbr /\u003e\n\n### Objective-C\n\n\u003cbr /\u003e\n\n GMSNavigationRoutingOptions *routingOptions =\n [[GMSNavigationRoutingOptions alloc] init];\n [navigator getRouteInfoForDestination:destination\n withRoutingOptions:routingOptions\n callback:^(GMSNavigationRouteInfo *routeInfo){...}];\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nSetting the routing strategy\n----------------------------\n\nYou can configure the routing strategy by using `GMSNavigationRoutingOptions`,\nand setting the `routingStrategy` when calling `setDestinations()`.\n\n`routingStrategy` takes one of the following enumeration values:\n\n| Enumeration Value | Description |\n|-----------------------------------------|----------------------------------------------------------------------------------------------|\n| GMSNavigationRoutingStrategyDefaultBest | Ranks routes by the Navigation SDK default cost model. This is the default routing strategy. |\n| GMSNavigationRoutingStrategyShorter | 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/ios-sdk/controls#hiding_alternate_routes) feature. Using these two features at the same time will produce unexpected results.\n\n### Example\n\nThe following code example demonstrates how to set the shorter route routing\nstrategy.\n\n\u003cbr /\u003e\n\n### Swift\n\n\u003cbr /\u003e\n\n let routingOptions = GMSNavigationRoutingOptions(routingStrategy: .shorter)\n navigator?.setDestinations(destinations,\n routingOptions: routingOptions) { routeStatus in\n ...\n }\n\n\u003cbr /\u003e\n\n### Objective-C\n\n\u003cbr /\u003e\n\n GMSNavigationRoutingOptions *routingOptions = [[GMSNavigationRoutingOptions alloc] initWithRoutingStrategy:GMSNavigationRoutingStrategyShorter];\n [navigator setDestinations:destinations\n routingOptions:routingOptions\n callback:^(GMSRouteStatus routeStatus){...}];\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nRoutes that include ferries\n---------------------------\n\nBy default, the Navigation SDK for iOS excludes routes that include ferries. If you prefer to\ninclude ferry options as part of your routes, you can adjust this routing\npreference to expose the trip to ferry segments by setting `avoidsFerries` to\n`false`.\n\n### Example\n\n\u003cbr /\u003e\n\n### Swift\n\n\u003cbr /\u003e\n\n self.mapView.navigator?.avoidsFerries = false\n\n\u003cbr /\u003e\n\n### Objective-C\n\n\u003cbr /\u003e\n\n self.mapView.navigator.avoidsFerries = NO\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThe route callout format\n------------------------\n\nUnder the shorter route routing strategy, callouts along the route display\ndistance details. But you can use the ETA callouts instead.\n\n### Configuring the route callout format\n\nYou can change the route callout format by setting `routeCalloutFormat` in\n`GMSMapView`. `routeCalloutFormat` takes one of the following enumeration\nvalues:\n\n| Enumeration Value | Description |\n|-----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|\n| GMSNavigationRouteCalloutFormatDefault | Displays time remaining when using the default best route routing strategy. Displays distance remaining when using the shorter route routing strategy |\n| GMSNavigationRouteCalloutFormatTime | Displays time remaining. |\n| GMSNavigationRouteCalloutFormatDistance | DDisplays distance remaining. |\n\n#### Example\n\nThe following code example demonstrates how to configure the route callout\nformat.\n\n\u003cbr /\u003e\n\n### Swift\n\n\u003cbr /\u003e\n\n self.mapView.routeCalloutFormat = .time\n\n\u003cbr /\u003e\n\n### Objective-C\n\n\u003cbr /\u003e\n\n _mapView.routeCalloutFormat = GMSNavigationRouteCalloutFormatTime;\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e"]]