Android Mapbox Marker Labels - android

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.

Related

How can i create a google maps marker that i customize at runtime android kotlin

How can i achieve a marker like the one in the picture below,that i can customize for every item at runtime,based on the item's attributes,in this example,price.
I have some knowledge about markers and customization,so im not a complete newbie,for example i was able to achieve this:
But in this case nothing is dynamic,the marker is the same for every item so it's not like what i want to achieve.
Have you looked at the utility library? It supports an IconGenerator class which you can use to display text on a marker. This seems to accomplish your use case.
See: https://github.com/googlemaps/android-maps-utils

How to change object color change using google ARCore SDK at run time in android?

I want to implement something like below feature in my AR application for which I use Google ARCore SDK.
Add an object in AR plane. Then select that object and select color from the list of different colors. And change the color of an added object without affecting an added object.
If its possible to change the color of some particular part then it will very fine.
Please help someone to get this concept idea. Thank you in advance.
You can use Sceneform SDK to do that.
This codelab explains in details how to add objects to scene using Sceneform - https://codelabs.developers.google.com/codelabs/sceneform-intro/#0
One way of doing what you want to do (maybe not the most efficient) - is to changes appropriate attribute of the renderable, remove the old one from the scene, add updated one into the scene.

How to put drawable for polyline pattern in Mapbox?

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.

Customizing MapBox Marker with Label

So far it seems like the API is limited to just being able to change the icon, but it would be nice if you could define a layout file or add a label above the icon that shows the title for instance, instead of requiring a tap interaction to show the info window. It's possible with Google Maps to define a layout and use that to create a cluster item to achieve this, but is it possible with MapBox since it is based on Mapbox GL?
Is this what you are trying to accomplish using Mapbox, bubble icons? They take in a string (in the image it is a price) and creates a bitmap icon for you to use as a marker icon.
I'll edit my answer with code if this is what you want.

Image with a centered text on of the google maps android version 2

In my monodroid project I try to add an image with a centered text to a specific lat/lng of google maps version 2.
With version 1 I add this by creating image and lable in a view and adding this view to the map as a subview.
But In new version we can not add subviews to the map. So how we can add such items to map?
EDIT
Actually I want to show something like this:
how can we add such markers with centered text on them?
Have a look at DemoIconProvider.java and getIconData function. It does basically the same what you see on your screen or here:
As always you will have to translate this from Java world to C#.

Categories

Resources