Start a new topic

GeoObject not displaying

I am trying to create a route to a marker object in the AR view, and the way i am planning on doing that is just to have waypoints the user can follow to reach the marker. I am getting the waypoints using the Google Directions API, and then only using the Lat and Lng of the waypoints. I am using those values to create GeoLocations and putting those into an array, which is then used to draw GeoObjects on a certain drawable i created. However, none of these GeoObjects are being displayed, i am unsure where i went wrong, any help would be greatly appreciated. My code is shown below:


onPoiRouteButtonClicked: function onPoiRouteButtonClickedFn() {

var directionsService = new google.maps.DirectionsService;

var currentMarker = World.currentMarker;

World.routeMarkerDrawable = new AR.ImageResource("assets/route.png");

var routeList = [];

var start = new google.maps.LatLng(World.userLocation.latitude, World.userLocation.longitude);
var end = new google.maps.LatLng(currentMarker.poiData.latitude, currentMarker.poiData.longitude);

directionsService.route({
origin: start,
destination: end,
travelMode: 'DRIVING'
}, function(response, status) {
if (status === 'OK') {


var route = response.routes[0];

// For each route, display summary information.
for (var routeMarkerNr = 0; routeMarkerNr < route.legs[0].steps.length; routeMarkerNr++) {

routeList.push(new AR.GeoLocation(route.legs[0].steps[routeMarkerNr].end_location.lat,route.legs[0].steps[routeMarkerNr].end_location.lng,AR.CONST.UNKNOWN_ALTITUDE));
}
new AR.GeoObject(routeList,
{
drawables : { cam : routeMarkerDrawable}
}
);

} else {
window.alert('Directions request failed due to ' + status);
}

});

},
Login or Signup to post a comment