Route not rendering

4 posts / 0 new
Last post
mheadd
Route not rendering

I'm using the MapQuest leaflet plugin for routing and am trying to replicate the examples in the docs.

When I try and replicate the 'Basic routing with single-line addresses' example, I can't seem to get the map / route to display. When digging through some of the API calls in Chrome dev tools, I see the following reponse:

{"route":{"routeError":{"message":"","errorCode":0}},"info":{"copyright":{"text":"© 2016 MapQuest, Inc.","imageUrl":"https://api-s.mqcdn.com/res/mqlogo.gif","imageAltText":"© 2016 MapQuest, Inc."},"statuscode":400,"messages":["No mapState found or fullShape specified in request.  You must provide a mapState or fullShape=true when requesting a Route Shape."]}});

It looks like the request is made with the proper mapState object in the querystring so I'm not really sure what is causing the problem. Any help inrecitfying would be appreciated.

Thanks!


MQBrianCoakley
The map needs to exist before
The map needs to exist before using the Leaflet routing plugin. If the route is needed before the map, the directions api can be hit directly - without the plugin.    If the map does exist and you're still getting the error, can you post a url where we can see this happening?

mheadd
So it turns out that the

So it turns out that the order in which external libraries are included was the cause of this. I was including jQuery before Leaflet and and the mapQuest plugins. Once I changed the order, and placed jQuery after including these libraries, it worked as expected.


MQBrianCoakley
Thanks for the information.
Thanks for the information. While that resolves the issue, it shouldn't be that way. I'll forward this on to the development team to assess.