Start a new topic

Distance to user update

Distance to user update

Hi there,

Using the selected POIS example, I'm having troubles with updating the description of markers to contain the distance to user value. I'm aware that other posts have been made on this topic already, but they seem to have implemented a different approach that would force me to rewrite alot and I think my approach is really close to working. 

Basically I want to description of the markers to show an updated distance every time the location changes, which I did through this code in selectingpois.js:


if (!World.initiallyLoadedData) {


requestDataFromLocal with the geo information as parameters (latitude, longitude) creates different poi data to a random location in the user's vicinity.


World.requestDataFromLocal(lat, lon);

World.initiallyLoadedData = true;

} else {

var marker = World.markerList;

var dist = marker.markerObject.locations.distanceToUser();


if (dist < 2) {

// Do something

marker.poiData.title = "I'm there";

                $("#status-message").html("You're there");


} else {

$("#status-message").html(dist.toString() + "m");

                marker.poiData.description = dist.toString();

                marker.poiData.title = "On your way";





When I debug and check the console log, the marker descriptions and title update perfectly. However, when I check the markers in AR in the actual camera view on my phone, the description and title are never updated, they always stay at their initial values. The status-message does update the distance and succeeds to show while running on my phone. Therefore it just seems that I need to add something that makes the marker re-initialize it's description and title.


Does anybody know how to do this final step?


Thanks a lot!



I found the problem. Instead of trying to this assignment: marker.poiData.title = "I'm there";,

I should have done this assignment: marker.titleLabel.text = "I'm there";

I hope it helps anyone out experiencing the same in the future.
Login or Signup to post a comment