Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show route overview in Mapview component #285

Open
nexttrack07 opened this issue Oct 1, 2024 · 2 comments
Open

Show route overview in Mapview component #285

nexttrack07 opened this issue Oct 1, 2024 · 2 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@nexttrack07
Copy link
Collaborator

Is there a way to draw a route overview in the MapView component? Please let me know if you have any suggestions. Looks there is a package called react-native-maps-directions that's used for this but it's not compatible with the MapView component. I am also wondering if we can leverage the directions API for this and use polylines?

@nexttrack07 nexttrack07 added triage me I really want to be triaged. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Oct 1, 2024
@akilakumarasamy
Copy link
Collaborator

The solution provided to resolve the issue to support stand along map (#254) is not helping us because we have to display a static route between markers. The MapView is not supporting to do a route. Any guidance on this? We still think supporting a stand alone map would be the best option.

@jokerttu jokerttu added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. labels Oct 7, 2024
@jokerttu
Copy link
Contributor

jokerttu commented Oct 7, 2024

@nexttrack07

The MapView is a classic map view and is not affected by or aware of the navigation state. To display a route on the MapView, you can retrieve the current route using the NavigationController.getRouteSegments method and draw the route segments with the MapViewController.addPolyline method.

If you want to use the NavigationView to show only the route, you can do the following:

Navigation must be initialized before the NavigationView is created. This is because, when navigation is initialized, the views are automatically synced with the navigation state on Android by the Navigation SDK. When navigation is initialized before drawing the view, the view is automatically set to the desired naigationUI state.

In the onMapViewControllerCreated callback for the NavigationView, hide the location marker if you don't want to display it:

mapViewController.setMyLocationEnabled(false);
mapViewController.setMyLocationButtonEnabled(false);

In the onNavigationViewControllerCreated callback:

navigationViewController.setNavigationUIEnabled(true); // Ensure navigation UI is enabled to show the route on iOS as well.
navigationViewController.showRouteOverview(); // Show the route overview.
navigationViewController.setNightMode(1); // Force day mode (if desired).

// Disable all view overlays in the NavigationView:
navigationViewController.setHeaderEnabled(false);
navigationViewController.setFooterEnabled(false);
navigationViewController.setRecenterButtonEnabled(false);
navigationViewController.setTrafficIncidentCardsEnabled(false);
navigationViewController.setSpeedometerEnabled(false);
navigationViewController.setTripProgressBarEnabled(false);

If this doesn't give you the expected result, would you mind uploading an image of the layout / mapview you're aiming for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants