Reputation: 427
I am following this example: https://docs.mapbox.com/android/maps/examples/symbol-layer-info-window/
Also here:
It is loading a number of points with descriptions from a file.
On line 271: String geoJson = loadGeoJsonFromAsset(activity, "us_west_coast.geojson");
What I need is to do the same dynamically. I have the information already as features in the map. I can get Title and Description from there. What I need is to use GenerateViewIconTask and setUpInfoWindowLayer when this event is triggered: onMapClick.
So basically a user taps on the map, I get the coordinates and search in the map's features, get the lat/lng, title and description and show up a callout on the map.
I can handle tapping, getting the map's feature, extracting title and description. What I need to do to finish with showing a nice callout on this location with title and description.
Upvotes: 0
Views: 530
Reputation: 493
Sorry for the late response. You can either show a label by setting the textfield
property or (according to the docs) create an info window by setting the iconImage
property to a string, like iconImage("{title}")
.
Sadly I've rarely used the latter as it never worked for me.
Upvotes: 1