How to zoom in and out the map maintaining the course to destination?
See original GitHub issueHere is the current implementation of zoom in and out of the map during navigation.
ivZoomIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavigationManager.getInstance().setMapUpdateMode(NavigationManager.MapUpdateMode.NONE);
m_map.setZoomLevel(m_map.getZoomLevel() + 0.5, Map.Animation.BOW);
tvReCenter.setVisibility(View.VISIBLE);
}
});
ivZoomOut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavigationManager.getInstance().setMapUpdateMode(NavigationManager.MapUpdateMode.NONE);
m_map.setZoomLevel(m_map.getZoomLevel() - 0.5, Map.Animation.BOW);
tvReCenter.setVisibility(View.VISIBLE);
tvReCenter.setVisibility(View.VISIBLE);
}
});
tvReCenter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
m_navigationManager.setMapUpdateMode(NavigationManager.MapUpdateMode.ROADVIEW);
GeoPosition lkp = PositioningManager.getInstance().getLastKnownPosition();
if (lkp != null && lkp.isValid())
m_map.setCenter(lkp.getCoordinate(), Map.Animation.BOW);
tvReCenter.setVisibility(View.GONE);
m_map.setZoomLevel(17.0f, Map.Animation.BOW);
}
});
With current implementation when we zoom in or out the map, the map remains still at the current position where it was zoomed and the position indication icon goes out of the map course to the destination. Actually we want to zoom in/out the map maintaining map updates and position indicator update. The reason of not updating the map is due to NavigationManager.getInstance().setMapUpdateMode(NavigationManager.MapUpdateMode.NONE);
but the problem is if we don’t this, the zoom in/out out the map doesn’t work.
If we zoom the map with the below code it didn’t zoom.
ivZoomOut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
m_map.setZoomLevel(m_map.getZoomLevel() - 0.5, Map.Animation.BOW);
}
});
Issue Analytics
- State:
- Created 4 years ago
- Comments:9
Top Results From Across the Web
Quickly Zoom In & Out of Maps with a Tap | OSXDaily
Zoom out by using a two-finger single tap on the active Maps screen · Zoom in by using a one finger double tap...
Read more >Map panning and zooming methods - Andy Woodruff
Here you click on the map and draw a box, specifying the extent and location to which you wish to zoom. Pros: Efficient...
Read more >Change the map view in CarPlay - Apple Support
In CarPlay, find your location on a map, zoom in and out, and move the map to see the detail you need.
Read more >Tutorials/Mapping - Minecraft Wiki - Fandom
To keep zoom-level 1 maps from overlapping, ensure that each is built from a zoom-level zero with x- and z-coordinates that are multiples...
Read more >Garmin Instinct Watch - Panning and Zooming the Map in ...
garminThis is a quick video to show you how pan and zoom the map during navigation on your Garmin Instinct watch.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Could you tell what exactly did not work for you? There is another more hacky way to achieve what you need, try this snippet:
@binod-techindustan In
NavigationManager.MapUpdateMode.ROADVIEW
mode you should useNavigationManager.getInstance().getRoadView().zoomOut()
orNavigationManager.getInstance().getRoadView().zoomIn()
methods.