Giter Club home page Giter Club logo

mapbox-navigation-ios-examples's Introduction

Mapbox Navigation SDK Examples

CircleCI

A collection of examples showing off the Mapbox Navigation SDK.

Installation

Installation with CocoaPods

  1. git clone https://github.com/mapbox/mapbox-navigation-ios-examples.git
  2. cd mapbox-navigation-ios-examples
  3. Go to your Mapbox account dashboard and create an access token that has the DOWNLOADS:READ scope. PLEASE NOTE: This is not the same as your production Mapbox API token. Make sure to keep it private and do not insert it into any Info.plist file. Create a file named .netrc in your home directory if it doesn’t already exist, then add the following lines to the end of the file:
    machine api.mapbox.com 
      login mapbox
      password YOUR_SECRET_MAPBOX_TOKEN
    
    where YOUR_SECRET_MAPBOX_TOKEN is your Mapbox API token with the DOWNLOADS:READ scope. The login should always be mapbox. It should not be your personal username used to create the secret token.
  4. Run pod repo update && pod install and open the resulting Navigation-Examples.xcworkspace.
  5. Sign up or log in to your Mapbox account and grab a Mapbox access token.
  6. Enter your Mapbox access token into the value of the MBXAccessToken key within the Info.plist file. Alternatively, if you plan to use this project as the basis for any open source application, read this guide to learn how to best protect your access tokens.
  7. Building and run the Navigation-Examples scheme.

Add an example:

  1. Add the example to /Examples.
  2. Add the example name to the Constants.swift.
  3. Run the app.

Additional resources

While we are not able to answer support questions in this repository, below are some helpful resources if you're just getting started with the Mapbox Navigation SDK for iOS:

mapbox-navigation-ios-examples's People

Contributors

1ec5 avatar azarovalex avatar bamx23 avatar captainbarbosa avatar chezzdev avatar frederoni avatar friedbunny avatar jill-cardamon avatar jinny-nam avatar jthramer avatar kried avatar mapbox-github-ci-writer-public-1[bot] avatar maximalien avatar pjleonard37 avatar s2ler avatar sevazhukov avatar shanma1991 avatar udumft avatar vincethecoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mapbox-navigation-ios-examples's Issues

Create new example which showcases Route usage

New example can be added to navigation-ios-examples which will allow to showcase how to:

  • initialize a Route in code (instead of direct usage of MapboxDirections API)
  • deserialize Route from JSON file

Objective-C examples

Most if not all of the examples in this repository should be ported to Objective-C, to better accommodate developers whose applications are already written in Objective-C. The ios-sdk-examples project shows what this could look like.

/cc @mapbox/navigation-ios

Remind developers to uninstall preview map view before starting turn-by-turn navigation

The location snapping (#93) and electronic horizon (#94) examples don’t present NavigationViewController, but it they did, there would be some surprising location tracking behavior, such as mapbox/mapbox-navigation-ios#2883, due to crosstalk between the preview map view, PassiveLocationDataSource, and RouteController. We should take the opportunity to remind developers to uninstall the map view or at least pause the PassiveLocationManager before presenting NavigationViewController. This step also has performance benefits.

/cc @mapbox/navigation-ios @bamx23

Blank screen on Xcode 11.4.1 and iOS 13.4.1

The example project don't work on the latest version of Xcode and iOS.

The projects build, but when run on simulator the following error is shown :
[Storyboard] Unknown class ViewController in Interface Builder file.

And we are presented with a blank screen.

Show how to bulid a Custom UI

If a developer does not want to use NavigationViewController and all of the pre-baked UI we bundle in the SDK, they should still be able to connect CoreNavigation to their own Custom UI.

This is a frequent request from developers that want to build custom turn-by-turn experiences, but none of our examples demonstrate how the key parts this type of implementation would work.

A new example that at the bare minimum demonstrates the following would be beneficial:

  • How to retrieve instructions from RouteProgress and pass them to a Custom UI element
  • How to trigger voice guidance when navigating with a Custom UI

cc: @mapbox/navigation-ios

Provide a reliable way of setting camera to current coordinate

Currently in many samples we have TODOs like here:

// TODO: Provide a reliable way of setting camera to current coordinate.
// TODO: Provide a reliable way of setting camera to current coordinate.

Example code shouldn’t have to-do items, so we need to find a way to use new camera API and improve existing code.

CircleCI support

To have parity with mapbox-navigation-ios CI support can be added to navigation-ios-examples as well. For now there is no way to check whether iOS Navigation examples (more specifically Navigation-Examples and DocsCode targets) can be built successfully other than running them locally using Xcode.

Explain example at the top of the example file

Following this comment: the examples contain code that is not relevant to understanding the example code's behavior. We should explain the example at the beginning of the example file so developers spend less time looking through example code to find the relevant code for their desired behavior.

/cc: @S2Ler @mapbox/navigation-ios

Avoid NSClassFromString usage

Currently, to add an example, you add a new UIViewController subclass, then add its name as a string to this array:

https://github.com/mapbox/navigation-ios-examples/blob/e1f256fee9788a8c323634e6829c197f73518bc5/Navigation%20Examples/ExampleTableViewController.swift#L12

ExampleContainerViewController then has a hack where it passes the string into NSClassFromString(), then inserts the resulting class inside itself:

https://github.com/mapbox/navigation-ios-examples/blob/65e0108af654c5b98efb15ce5e0ba0682800eda9/Navigation%20Examples/ExampleContainerViewController.swift#L26

This approach is all downside and no upside. For example, when I add an example, the compiler won’t warn me if I mistype the class name or accidentally put ExampleContainerViewController into the array.

Instead, the examples array should be an array of AnyClass. Then tableView(_:cellForRowAt:) would use NSStringFromClass() to get a string to display, and prepare(for:) would set className directly to the item at the correct index of examples.

/cc @bsudekum

Use Cocoapods CDN in Podfile

Currently, running pod install will result in the next warning:

[!] Your project does not explicitly specify the CocoaPods master specs repo. 
Since CDN is now used as the default, you may safely remove it from your repos directory via `pod repo remove master`. 
To suppress this warning please add `warn_for_unused_master_specs_repo => false` to your Podfile.

Update Navigation SDK iOS examples for v1.0.0-rc.3.

Since in v1.0.0-rc.3 some modifications to public API were made (e.g. in NavigationViewController initializer, routeLineTracksTraversal was moved to NavigationViewController etc) Navigation SDK iOS examples should be updated to reflect this.

Show how to customize waypoints

An example of how to customize waypoints would be useful. I'll try to start an example that illustrates how to distinctly style waypoints, such as for using different icons for pickup and dropoff points.

cc @1ec5

Icons replicate when you move the map

Steps to reproduce

  1. Select either Advanced Implementation or Custom Waypoint Styling example
  2. Long press to generate route and start navigation
  3. Drag map around

Expected behavior

Mapbox and information icons don't replicate when map is dragged.

Simulator Screen Shot - iPhone 8 Plus - 2021-04-15 at 11 25 42

Actual behavior

Mapbox and information icons replicate when map is dragged.

Simulator Screen Shot - iPhone 8 Plus - 2021-04-15 at 11 25 45

Example for custom location manager

Currently, the navigation SDK documentation for iOS doesn't have a guide for device location like Android does since device location and location management usually works by default on iOS. However, to get closer to documentation parity, a guide or example could be helpful. It would be challenging to find enough information to fill an iOS location guide, but an example could be useful.

A new example for creating a custom location manager would also be helpful for cleaning up locations outside of turn-by-turn navigation, debugging, and simulation.

Route styling example.

Currently Navigation SDK provides the ability to style main/alternative routes using these delegate methods in NavigationMapView:

navigationMapView(_:mainRouteStyleLayerWithIdentifier:source:)
navigationMapView(_:mainRouteCasingStyleLayerWithIdentifier:source:)
navigationMapView(_:alternativeRouteStyleLayerWithIdentifier:source:)
navigationMapView(_:alternativeRouteCasingStyleLayerWithIdentifier:source:)

Usage of these methods can be showcased in separate sample app.

Example for refreshing a route on a preview map

If the application calculates and displays a route on a preview map, but the user leaves the preview map sitting there for over 2 minutes without starting a trip, the application should ideally refresh the route to reflect current traffic conditions. The process is straightforward but not especially discoverable, so we should add an example of it.

As far as I can tell, refreshing the route would entail:

  1. Call Directions.refreshRoute(responseIdentifier:routeIndex:fromLegAtIndex:completionHandler:) on a timer.
  2. In the completion handler, call Route.refreshLegAttributes(from:).
  3. Call NavigationMapView.show(_:legIndex:).

It’s only possible to refresh a single route at a time. We could chain the refresh calls to refresh all the routes in series, or we could refresh only the currently selected route, restarting the timer when selecting a different route.

/cc @mapbox/navigation-ios

Add example of location snapping in standalone map view

As of mapbox/mapbox-navigation-ios#2410, the developer can hook up a PassiveLocationManager to a map view outside of active turn-by-turn navigation, such as for browsing or previewing a route, to snap location updates to the road network. This feature is also called “free-driving localization”, but we should probably title the example something more task-oriented, like “Snapping locations in standalone map view”, so that the developer doesn’t overlook this example thinking it has to do with avoiding tolls or translating guidance instructions.

/cc @mapbox/navigation-ios

Waypoint-Arrival-Screen uses incorrect API to advance index

navigationViewController.navigationService.routeProgress.legIndex += 1

Advance legIndex by manually changing it. It is not a proper way to change legIndex anymore. https://github.com/mapbox/mapbox-navigation-ios/blob/4d5138008b441168c9cb976d90fd84fe1c44bd10/Sources/MapboxCoreNavigation/RouteController.swift#L130 should be used instead.

Building example project in Xcode 12.4 Error

When i tried to build and run for Device (iphone 11 with iOS 14 )

building for iOS, but linking in dylib file (/Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Products/Debug-iphoneos/MapboxAccounts.framework/MapboxAccounts) built for Mac Catalyst, file '/Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Products/Debug-iphoneos/MapboxAccounts.framework/MapboxAccounts' for architecture arm64

When i tried to run on simulator:

Ld /Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Products/Debug-iphonesimulator/MapboxCoreNavigation/MapboxCoreNavigation.framework/MapboxCoreNavigation normal (in target 'MapboxCoreNavigation' from project 'Pods')
cd /Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-ios12.0-simulator -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk -L/Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Products/Debug-iphonesimulator/MapboxCoreNavigation -F/Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Products/Debug-iphonesimulator/MapboxCoreNavigation -F/Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Products/Debug-iphonesimulator/MapboxDirections -F/Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Products/Debug-iphonesimulator/MapboxMobileEvents -F/Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Products/Debug-iphonesimulator/Polyline -F/Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Products/Debug-iphonesimulator/Turf -F/Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxAccounts -F/Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxAccounts/MapboxAccounts.xcframework/ios-arm64_armv7 -F/Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxAccounts/MapboxAccounts.xcframework/ios-arm64_i386_x86_64-simulator -F/Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxAccounts/MapboxAccounts.xcframework/ios-arm64_x86_64-maccatalyst -F/Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxCommon -F/Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxCommon/MapboxCommon.xcframework/ios-arm64_armv7 -F/Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxCommon/MapboxCommon.xcframework/ios-arm64_i386_x86_64-simulator -F/Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxCommon/MapboxCommon.xcframework/ios-x86_64-maccatalyst -F/Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxNavigationNative -F/Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxNavigationNative/MapboxNavigationNative.xcframework/ios-arm64_armv7 -F/Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxNavigationNative/MapboxNavigationNative.xcframework/ios-arm64_i386_x86_64-simulator -filelist /Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/MapboxCoreNavigation.build/Objects-normal/x86_64/MapboxCoreNavigation.LinkFileList -install_name @rpath/MapboxCoreNavigation.framework/MapboxCoreNavigation -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/MapboxCoreNavigation.build/Objects-normal/x86_64/MapboxCoreNavigation_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/MapboxCoreNavigation.build/Objects-normal/x86_64/MapboxCoreNavigation.swiftmodule -framework MapboxAccounts -framework MapboxCommon -framework MapboxNavigationNative -framework Foundation -framework MapboxDirections -framework MapboxMobileEvents -framework Turf -Xlinker -no_adhoc_codesign -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/MapboxCoreNavigation.build/Objects-normal/x86_64/MapboxCoreNavigation_dependency_info.dat -o /Users/kavehmohammadpour/Library/Developer/Xcode/DerivedData/Navigation-Examples-awnrhthmcpxmivdzpehdnkettjdb/Build/Products/Debug-iphonesimulator/MapboxCoreNavigation/MapboxCoreNavigation.framework/MapboxCoreNavigation

ld: warning: ld: warning: ignoring file /Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxAccounts/MapboxAccounts.xcframework/ios-arm64_armv7/MapboxAccounts.framework/MapboxAccounts, missing required architecture x86_64 in file /Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxAccounts/MapboxAccounts.xcframework/ios-arm64_armv7/MapboxAccounts.framework/MapboxAccounts (2 slices)ignoring file /Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxCommon/MapboxCommon.xcframework/ios-arm64_armv7/MapboxCommon.framework/MapboxCommon, missing required architecture x86_64 in file /Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxCommon/MapboxCommon.xcframework/ios-arm64_armv7/MapboxCommon.framework/MapboxCommon (2 slices)
ld: warning: ignoring file /Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxNavigationNative/MapboxNavigationNative.xcframework/ios-arm64_armv7/MapboxNavigationNative.framework/MapboxNavigationNative, missing required architecture x86_64 in file /Users/kavehmohammadpour/Desktop/MapBox-Test/mapbox-navigation-ios-examples/Pods/MapboxNavigationNative/MapboxNavigationNative.xcframework/ios-arm64_armv7/MapboxNavigationNative.framework/MapboxNavigationNative (2 slices)

Undefined symbols for architecture x86_64:
"OBJC_CLASS$_MBXWaypoint", referenced from:
objc-class-ref in RouteController.o
"OBJC_CLASS$_MBXUpcomingRouteAlert", referenced from:
objc-class-ref in RouteController.o
"OBJC_CLASS$_MBXMapMatch", referenced from:
objc-class-ref in PassiveLocationDataSource.o
"OBJC_CLASS$_MBXTilesConfig", referenced from:
objc-class-ref in OfflineDirections.o
objc-class-ref in PassiveLocationDataSource.o
objc-class-ref in RouteController.o
"OBJC_CLASS$_MBXActiveGuidanceOptions", referenced from:
objc-class-ref in RouteController.o
"OBJC_CLASS$_MBXAccounts", referenced from:
objc-class-ref in MBXAccounts+CoreNavigationAdditions.o
_OBJC$CATEGORY_MBXAccounts$_CoreNavigationAdditions in MBXAccounts+CoreNavigationAdditions.o
objc-class-ref in NavigationService.o
"OBJC_CLASS$_MBXFixLocation", referenced from:
objc-class-ref in PassiveLocationDataSource.o
objc-class-ref in RouteController.o
"OBJC_CLASS$_MBXTileEndpointConfiguration", referenced from:
objc-class-ref in PassiveLocationDataSource.o
"_MBXAccountsSKUIDNavigationUser", referenced from:
+[MBXAccounts(CoreNavigationAdditions) load] in MBXAccounts+CoreNavigationAdditions.o
"OBJC_CLASS$_MBXNavigatorConfig", referenced from:
objc-class-ref in OfflineDirections.o
objc-class-ref in PassiveLocationDataSource.o
objc-class-ref in RouteController.o
"OBJC_CLASS$_MBXNavigator", referenced from:
objc-class-ref in OfflineDirections.o
objc-class-ref in PassiveLocationDataSource.o
objc-class-ref in RouteController.o
"OBJC_CLASS$_MBXSettingsProfile", referenced from:
objc-class-ref in OfflineDirections.o
objc-class-ref in PassiveLocationDataSource.o
objc-class-ref in RouteController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Custom destination marker sample implements deprecated method

Custom-Destination-Marker.swift sample implements func navigationViewController(_ navigationViewController: NavigationViewController, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage? NavigationViewControllerDelegate method which was deprecated a while ago and no longer called. This is misleading for users who run this sample since default annotation is shown instead of annotation with custom image. Sample should be updated to show custom annotation and call correct delegate method.

Add Offline Regions Example

Add an example for Offline Regions feature.
This example should cover:

  • Creating a custom TileStore
  • Downloading a region (could have several hard-coded offline regions to download)
  • Listing downloaded regions
  • Refreshing outdated region
    A simplest example would be to attempt to refresh all existing regions.
  • Removing a region

Add example of using Directions API beta query parameters

At any given time, the Directions API documentation describes several query parameters that are available for beta testing. Since these parameters lack long-term support, the MapboxDirections library can’t support them and guarantee API stability at the same time. However, it is possible for developers to take advantage of these parameters by subclassing RouteOptions or better yet NavigationRouteOptions, overriding the query item array that goes into the generated request URL. We should have an example of this custom usage; it would be easier to keep this example up-to-date with any beta-related changes than to update the library itself.

For example, here’s a NavigationRouteOptions subclass that takes advantage of the maxspeed query parameter, which is currently in beta, to identify routes suitable for street-legal golf carts and calculate an ETA based on a departure an hour from now. (Street-legal golf carts are sometimes used in urban areas for delivery purposes. In Ohio, they may be capable of travel up to 20 miles per hour but no faster.)

class GolfCartRouteOptions: NavigationRouteOptions {
    override var urlQueryItems: [URLQueryItem] {
        let maximumSpeed = Measurement(value: 20, unit: UnitSpeed.milesPerHour) // maximum legal speed in Ohio
        let hourFromNow = Date().addingTimeInterval(60 * 60) // an hour from now
        let hourFromNowString = ISO8601DateFormatter.string(from: hourFromNow, timeZone: .current, formatOptions: .withInternetDateTime)
        return super.urlQueryItems + [
            // Assuming this parameter is supposed to be expressed in kilometers per hour
            URLQueryItem(name: "maxspeed", value: String(maximumSpeed.converted(to: .kilometersPerHour).value)),
            URLQueryItem(name: "depart_at", value: hourFromNowString),
        ]
    }
}

let options = GolfCartRouteOptions(coordinates: coordinates, profileIdentifier: .automobile)

Relatedly, for customers who are allowed to use a routing profile that isn’t officially documented for the general public, we could point out the possibility of setting profileIdentifier to a custom value such as DirectionsProfileIdentifier(rawValue: "mapbox/unicycle").

/cc @mapbox/navigation-ios

Add intermediate waypoints

Hi there,

A question. I'm trying to record and save specific routes to our own api we wrote. Now there is an example for custom routes and there you comment that we can specify more intermediate waypoints. We want to specify that you start from your location so WP1, the start location of the route WP2, this happens with autorouting. But from WP2 to the end location of the route or WP3, we want to use the exact route we saved to the own database. Can you please tell us how we do this?

Navigation-Examples/Examples/Custom-Server.swift

Thanks in advance

Disable proactive rerouting, route refreshing after map matching

The “Custom Server” example relies on the Map Matching API to derive a route from a series of waypoints. This example is intended for a “Bring Your Own Route” use case where the waypoints are control points from a route produced by another routing engine. In that case, proactive rerouting would automatically undo any customization implemented through the BYOR workflow. The route refreshing functionality added in mapbox/mapbox-navigation-ios#2284 would also fail because the route doesn’t come from the Directions API but is instead synthesized on the client-side.

The navigation SDK has no way to distinguish a Route obtained through Directions.calculateRoutes(matching:completionHandler:) from one obtained through calculate(_:completionHandler:). So it falls to the developer to disable proactive rerouting and route refreshing manually:

let router = navigationViewController.navigationService.router
router.reroutesProactively = false
router.refreshesRoute = false

We should add these lines to the “Custom Server” example:

https://github.com/mapbox/navigation-ios-examples/blob/e85b6f530e7b6a0e9fe8f18f5d22472323e43eb7/Navigation-Examples/Examples/Custom-Server.swift#L30-L33

/cc @mapbox/navigation-ios

Announcement: main is now the default branch

main is now this repository’s default branch. Most development takes place on this branch, and releases will be based on this branch. For more context on the branch renaming, see github/renaming.

Like most GitHub repositories, this repository originally maintained master as the default branch. During the v1.0 release cycle, we maintained main as an alias for the master branch, keeping both branches in sync using FF-merging. Now that v1.0 has been released, we’ve made main the default branch. All open pull requests now target the main branch; please target it going forward.

To avoid breaking existing workflows or continuous integration builds, we’ve avoided deleting the master branch for now. However, that branch will only be kept in sync with the main branch on a best-effort basis. Eventually we expect to let that branch fall by the wayside.

This is also a good reminder that you should link to code within a repository using a permalink that specifies a specific commit or at least a specific branch, so that the link continues to function after a branch gets renamed or, more commonly, after a file gets renamed or code get shifted around.

/cc @mapbox/navigation-ios @mapbox/docs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.