Start a new topic

How to update POI description attribute text with distance to User

 Hi. Can you please tell me what I should assign within the code below, in replacement of the red text, to update each marker description attribute with distance to user? Everything I've tried doesn't result in a change to the default marker description text when the markers are displayed.

locationChanged: function locationChangedFn(lat, lon, alt, acc) {
World.userLocation = {
'latitude': lat,
'longitude': lon,
'altitude': alt,
'accuracy': acc

if (World.locationUpdateCounter === 0) {
for (var i = 0; i < World.markerList.length; i++) {
World.markerList[i].distanceToUser = World.markerList[i].markerObject.locations[0].distanceToUser();
World.markerList[i].poiData.description = World.markerList[i].distanceToUser.toString();

World.locationUpdateCounter = (++World.locationUpdateCounter % World.updatePlacemarkDistancesEveryXLocationUpdates);

Hi Alex.

Thank you for responding. It works as hoped. Thank you.


you can change the text of the description label with the text property. 


World.markerList[i].descriptionLabel.text = World.markerList[i].distanceToUser.toString();

Best Regards,


Thanks for responding.

I've tried what you've suggested 

World.markerList[i].markerObject.description = World.markerList[i].distanceToUser.toString();

without a change from the display of default text.

You need to edit the label itself.
maybe check World.markerList[i].markerObject not World.markerList[i].poiData

Can I get help please?

Login or Signup to post a comment