Using Leaflet don't work for Italy

3 posts / 0 new
Last post
servitel
Using Leaflet don't work for Italy

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>


servitel
Fixed adding a more explicit

Fixed adding a more explicit address "29 via giovanni battista crespi" instead of "29 via crespi"


MQBrianCoakley
The routing and mapping
The routing and mapping should definitely work. But outside the US make sure the full address is being used for best results.