Hi
I'm a newbie on Mapquest.
Just tried to create a route with 4 points located in Italy. The system display a very crazy map.
You can see the result here: http://www.asendship.it/mappa.html
Any idea ?
This is the full code I use (myKey contain my right APIKey passed as a text):
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.js"></script>
<script src="https://www.mapquestapi.com/sdk/leaflet/v2.2/mq-map.js?key=myKey"></script>
<script src="https://www.mapquestapi.com/sdk/leaflet/v2.2/mq-routing.js?key=myKey"></script>
<script type="text/javascript">
window.onload = function() {
var map;
var dir;
map = L.map('map', {
layers: MQ.mapLayer(),
center: [ 45.4469400, 8.6211800 ],
zoom: 15
});
dir = MQ.routing.directions();
dir.route({
locations: [
{ street: '239 viale giulio cesare', city: 'novara', state: 'no', country: 'italy' },
{ street: '29 via crespi', city: 'novara', state: 'no', country: 'italy' },
{ street: '14 via crespi', city: 'novara', state: 'no', country: 'italy' },
{ street: '7 viale roma', city: 'novara', state: 'no', country: 'italy' }
]
});
map.addLayer(MQ.routing.routeLayer({
directions: dir,
fitBounds: true
}));
}
</script>
</head>
<body style='border:0; margin: 0'>
<div id='map' style='width: 100%; height:530px;'></div>
</body>
</html>
Fixed adding a more explicit address "29 via giovanni battista crespi" instead of "29 via crespi"