I'm using mapbox for map navigation.. is it possible to add markers on navigation view on mapbox like the waze app? when you start navigating markers are still shown on navigation
The NavigationView allows access to the MapboxMap via NavigationView#retrieveMap(). Once initialized, you should be able to use this to create your own SymbolManager using the annotation plugin. You can then use the plugin as your normally would to add / remove custom markers to the map.
Related
I couldn't find ViewAnnotationPlugin and PointAnnotationPlugin classes after implementing Mapbox annotation plugin in my project.
I'm trying to implement custom views on top of Mapbox map using Java to look like a map pin but customized.
Views could be an image or a custom Android layout.
In this Mapbox documentation they're referring to use ViewAnnotationPlugin and PointAnnotationPlugin, but I couldn't find these classes after implementing Mapbox annotation plugin in my project.
Here's what I've implemented:
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0'
Here's the mapbox documentation I'm referring to:
https://docs.mapbox.com/android/maps/examples/view-annotation-with-point-annotation/
Is this the correct way for showing custom views on specific coordinates using Mapbox, while keeping in mind the map camera changes should not affect the custom views added on the map?
I'm trying to figure out how to make a dynamically generated list of markers display a dynamic text label on the map (not in the infoWindow). I know it's possible because I've used this feature in Mapbox Studio - I just can't figure out how to do it on Android! I considered creating a static Bitmap icon with the text incorporated, but that doesn't seem very flexible compared to the Mapbox Studio version, so I'd like to avoid it if I can! Any suggestions?
You're trying to do what's called data-driven styling
You should use a SymbolLayer to show text on a map. If the text you want to show is based on GeoJSON Features in your data set, then use the get expression in the textField property of a SymbolLayer.
FeatureCollection featureCollection = FeatureCollection.fromFeatures();
GeoJsonSource geoJsonSource = new GeoJsonSource("source-id", featureCollection);
mapboxMap.addSource(geoJsonSource);
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id")
.withProperties(PropertyFactory.textField(Expression.get("FEATURE-PROPERTY-KEY")));
mapboxMap.addLayer(symbolLayer);
The Annotation Plugin simplifies some of this. Also for reference to see how SymbolLayers are used, there is the Mapbox Android demo app.
Just like for marker where we can put drawable for its icon, such as with Marker's .SetIcon(), how to do the same with Mapbox's polyline?
I've searched Google but, CMIIW, seems like there isn't a way to do that yet? Some links I think are related:
Github - Dotted Polyline on Android
Runtime Styling API
Any suggestion?
Unfortunately, Polyline doesn't support custom patterns. What I'd suggest is using LineLayer with PropertyFactory.linePattern() where you pass ID of an image previously added to the map via MapboxMap#addImage().
Here is an example activity that uses LineLayer.
I was implementig maps extensions in my solution, and i cant figure out how to activate the cluster transition animation. There is a class called ClusterAnimator but is not used in the example.
So the question is, how can activate the cluster transitions in android map extensions implementation using the default clustering strategy?.
I want to get the same transition than the original maps library does on zoom in and out with the markers and clusters.
Have you set your clustermanager as the mapview's OnMapCameraChangeListener ?
Take a look at the BigClusteringDemoActivity demo-application, which does the following:
getMap().setOnCameraChangeListener(mClusterManager);
EDIT I wrongly assumed that the question was about Google Maps Android API utility library and its ClusterManager, which it wasn't.
Is there a way to add shadow conveniently as in V3? Otherwise my solution is to add another marker to the same location with its icon the shadow of the original marker's icon.. and with click listener disabled.. That seems bad though. Any idea? Thanks in advance!:)
Create a Bitmap that contains both marker and its shadow and assign it using BitmapDescriptorFactory.fromBitmap or simply create a png file that contains all you need and use BitmapDecriptorFactory.fromResource.