Hi,

i'm developing a webapp and i'm having some troble with the use of the method RouteSummary() and to clear a route already routed. My code is:


<script type="text/javascript">
var way;
function val(what) {
way = what.value;
load();
}

var locat = null;
var end = null;
var container = null;
var map;
var MyinfoBubbles;
var router;
var waypoints;
var resum;

//if(getUrlVars()['maps']=='nokia'||getUrlVars()['maps']=='false') {
nokia.Settings.set( "appId", "MYKEY");
nokia.Settings.set( "authenticationToken", "MYKEY");
$(document).ready(function () {

map = new nokia.maps.map.Display(document.getElementById("mapContainer"), {
'center': [-22.9069, -47.0613],
'zoomLevel': 17,
components: [ new nokia.maps.map.component.Behavior() ]
});
load();
});

function load() {
var timeoutVal = 10 ;
navigator.geolocation.getCurrentPosition(success, error,
{ enableHighAccuracy: false, timeout: timeoutVal, maximumAge: 0 });
}
function error(msg) {
switch(msg.code)
{
case msg.PERMISSION_DENIED:
//alert("User denied the request for Geolocation.");
alert("Para utilizar o CLOG é necessário aceitar o compartilhamento de sua localização.");

break;
case msg.POSITION_UNAVAILABLE:
alert("O nao conseguiu obter sua localização.");

break;
case msg.TIMEOUT:
//alert("The request to get user location timed out.");
alert("O tempo maximo de busca de sua localização foi excedido.");

break;
case msg.UNKNOWN_ERROR:
alert("An unknown error occurred.");

break;
}

}
function success(position) {
var lat = position.coords.latitude;
var lon = position.coords.longitude;
locat = new nokia.maps.geo.Coordinate(lat, lon);
nokia.places.search.manager.reverseGeoCode({
latitude: lat,
longitude: lon
});


var waypoints = new nokia.maps.routing.WaypointParameterList();
waypoints.addCoordinate(locat);
waypoints.addCoordinate(new nokia.maps.geo.Coordinate(-29.915393,-49.051036));

var modes = [{
type: "shortest",
transportModes: [way],
options: "",
trafficMode: "default"
}];

router = new nokia.maps.routing.Manager();
var onRouteCalculated = function (observedRouter, key, value) {
if (value == "finished") {
//map.set(null);
var routes = observedRouter.getRoutes();
mapRoute = new nokia.maps.routing.component.RouteResultSet(routes[0]).container;
map.objects.add(mapRoute);
map.zoomTo(mapRoute.getBoundingBox(), false, "default");
} else if (value == "failed") {
alert("The routing request failed.");
}
};
router.addObserver("state", onRouteCalculated);
router.calculateRoute(waypoints, modes.slice(0));
//router.calculateRoute(waypoints, modes);

}
//}


</script>
<style type="text/css">
#mapContainer {

position:absolute;
top:35px;
left:0;
display:block;
height: 94%;
width: 100%;

}

#up{
width: 106%;
height: 40px;
margin-left:-10px;
margin-top: -10px;
text-align: center;
letter-spacing: 30%;
white-space: nowrap;
overflow: hidden;
background-color:#000;
color:#FFF;


}

a:visited {color: #ffffff;}
a:link {color: #ffffff;}
a:bover {color: #000000;}
a:active {color: #000000;}
</style>

</head>
<body>
<div id="up">

<input class="button" type="button" value="pedestrian" onClick="val(this)">
<input class="button" type="button" value="publicTransport" onClick="val(this)">
<input class="button" type="button" value="car" onClick="val(this)">

<div id="mapContainer"></div>

</div>

So, when the user clicks on the button pedestrian, publicTransport or Car, the app will trace another route with the selected option, but in my case, it traces as many as the user click, so i need to update the new route to not show the older anymore.

In the RouteSummary() method, i want to show the average time to the user reach his destination, but i can do this because i don't know how to use it.

Thanks a lot