MapquestAPI claiming i don't provide 2 locations

13 posts / 0 new
Last post
wschlosser
MapquestAPI claiming i don't provide 2 locations

Hi everyone,

 I'm working with the mapquest API trying to calculate distance between two locations and the API is returning the following error

Route error code: 211

Message: ""

info status code: 611

message: "The LocationCollection must contain at least 2 locations."

The url is formatted like the following:

https://www.mapquestapi.com/directions/v2/route?key=****&doReverseGeocod...

Since both from and to are provided, i shouldn't be getting any return errors, right? Can someone provide some insight?


MQBrianCoakley
When I put my key in that
When I put my key in that request I get a 402: We are unable to route with the given locations.   If I put in valid locations it works great. https://www.mapquestapi.com/directions/v2/route?key=KEY&doReverseGeocode...

wschlosser
Here are 'valid locations'

Here are 'valid locations' that still return the error:

https://www.mapquestapi.com/directions/v2/route?key=***&from=2490+South+...


MQBrianCoakley
Make sure you url encode the
Make sure you url encode the #'s in the url: %23. # is a url reserved character. This worked great for me.   https://www.mapquestapi.com/directions/v2/route?key=KEY&from=2490+South+...

wschlosser
That seems to have done it,

That seems to have done it, thanks.


CFeltgen
Route error code: 211 Message: "" info status code: 611

I also get the same error message when i use the following

var jsmyRouteStops= $(".variable-content").text();

var mystop =jsmyRouteStops.replace(/:,/g, "','");

mystop=mystop.replace(/:/g, "");

var rt=new Array();

var x;

var locations="'";

var stop= mystop.split(",");

for(x=0;x<stop.length;x++){

locations+=stop[x]+',';

}

locations=locations.replace(/.$/,"'");

dir.route({locations:[locations]});

 

but when I replace the variable with addresses it works not sure why

 

var jsmyRouteStops= $(".variable-content").text();
var mystop =jsmyRouteStops.replace(/:,/g, "','");
mystop=mystop.replace(/:/g, "");
var rt=new Array();
var x;
var locations="'";
var stop= mystop.split(",");
for(x=0;x<stop.length;x++){
locations+=stop[x]+',';
}
locations=locations.replace(/.$/,"'");
dir.route({locations:['100 W Atlantic Blvd Pompano Beach FL, 33060-6099','2541 NE 11th St Pompano Beach FL, 33062-4113','2610 NE 10th Ave Pompano Beach FL, 33064-6429','4611 N Federal Hwy Pompano Beach FL, 33064-6510','600 SW 3rd St Pompano Beach FL, 33060-6931','330 SW 12th Ave Pompano Beach FL, 33069-3502','2681 S Course Dr Pompano Beach FL, 33069-3901','3050 N Palm Aire Dr Pompano Beach FL, 33069-3409','4200 Oaks Ter Pompano Beach FL, 33069-5507','905 Cypress Ter Pompano Beach FL, 33069-4008','3500 Oaks Clubhouse Dr Pompano Beach FL, 33069-3685','3993 Cypress Reach Ct Pompano Beach FL, 33069-4901','110 SE 7th Way Pompano Beach FL, 33060-7389','120 SE 7th Way Pompano Beach FL, 33060-7389','130 SE 7th Way Pompano Beach FL, 33060-7389','140 SE 7th Way Pompano Beach FL, 33060-7389','150 SE 7th Way Pompano Beach FL, 33060-7389','[100 - 150] SE 7th Way Pompano Beach FL, 33060-7389','[100 - 150] SE 7th Way Pompano Beach FL, 33060-7389']});

 

Please help

 

 


MQBrianCoakley
If you remove the last 2
If you remove the last 2 locations with the bracketed address range, [100-150], does the route work? If so, make sure the address text is encoded.

CFeltgen
The bottom code works with

The bottom code works with the last two addresses in.  Its the first example with the addresses replaced with the variable locations that the code gives me the error


MQBrianCoakley
Grab the resulting request
Grab the resulting request from the browser network tab to see what is failing. You can post the request here and we can take a deeper look.

CFeltgen
[REQUEST]

[REQUEST]

https://www.mapquestapi.com/directions/v2/route?key=Ua9ZeTylyZUf11xtzt5N...{%22locations%22:[%22%27100%20W%20Atlantic%20Blvd%20Pompano%20Beach%20FL,%2033060-60992217%20NE%202nd%20St%20Pompano%20Beach%20FL,%2033062-48031181%20NE%2023rd%20Ter%20Pompano%20Beach%20FL,%2033062-41202403%20N%20Riverside%20Dr%20Pompano%20Beach%20FL,%2033062-12301505%20N%20Riverside%20Dr%20Pompano%20Beach%20FL,%2033062-33091012%20N%20Ocean%20Blvd%20Pompano%20Beach%20FL,%2033062-4008510%20N%20Ocean%20Blvd%20Pompano%20Beach%20FL,%2033062-46073316%20SE%203rd%20St%20Pompano%20Beach%20FL,%2033062-55063312%20SE%203rd%20St%20Pompano%20Beach%20FL,%2033062-55061331%20W%20Terra%20Mar%20Dr%20Pompano%20Beach%20FL,%2033062-68112020%20Terra%20Mar%20Dr%20Pompano%20Beach%20FL,%2033062-71011360%20S%20Ocean%20Blvd%20Pompano%20Beach%20FL,%2033062-71411333%20S%20Ocean%20Blvd%20Pompano%20Beach%20FL,%2033062-6901111%20Briny%20Ave%20Pompano%20Beach%20FL,%2033062-5604299%20N%20Riverside%20Dr%20Pompano%20Beach%20FL,%2033062-5002701%20N%20Riverside%20Dr%20Pompano%20Beach%20FL,%2033062-4513%27%22],%22options%22:{%22shapeFormat%22:%22cmp6%22,%22conditionsAheadDistance%22:200,%22generalize%22:0},%22maxRoutes%22:1}&callback=callback_json1

[RESPONSE]

callback_json1({"route":{"routeError":{"errorCode":211,"message":""}},"info":{"statuscode":611,"copyright":{"imageAltText":"© 2018 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif","text":"© 2018 MapQuest, Inc."},"messages":["At least two locations must be provided."]}});

 


MQBrianCoakley
All of those locations are

All of those locations are combined into one string so the whole list is read as the route origin with no destination. Separate the addresses and you should be good to go.

 

https://www.mapquestapi.com/directions/v2/route?key=KEY&json={"locations":["100 W Atlantic Blvd Pompano Beach FL, 33060-6099","2217 NE 2nd St Pompano Beach FL, 33062-4803","1181 NE 23rd Ter Pompano Beach FL, 33062-4120","2403 N Riverside Dr Pompano Beach FL, 33062-1230","1505 N Riverside Dr Pompano Beach FL, 33062-3309","1012 N Ocean Blvd Pompano Beach FL, 33062-4008","510 N Ocean Blvd Pompano Beach FL, 33062-4607","3316 SE 3rd St Pompano Beach FL, 33062-5506","3312 SE 3rd St Pompano Beach FL, 33062-5506","1331 W Terra Mar Dr Pompano Beach FL, 33062-6811","2020 Terra Mar Dr Pompano Beach FL, 33062-7101","1360 S Ocean Blvd Pompano Beach FL, 33062-7141","1333 S Ocean Blvd Pompano Beach FL, 33062-6901","111 Briny Ave Pompano Beach FL, 33062-5604","299 N Riverside Dr Pompano Beach FL, 33062-5002","701 N Riverside Dr Pompano Beach FL, 33062-4513"],"options":{"shapeFormat":"cmp6","conditionsAheadDistance":200,"generalize":0},"maxRoutes":1}&callback=callback_json1

 


jadecruz2
Map Direction

Hi. Is there an option here where I can locate the host provider of an specific website? like[removed for privacy]. I was trying to check its location.


MQBrianCoakley
Nope, MapQuest does not offer
Nope, MapQuest does not offer this functionality.