Register  |  Login



Earn money by sharing your knowledge through Quomon's revenue sharing program

Question

Status: Closed Points: 250 Time: 11:19 - Mar 11, 2007  

hknight

Help with Mapquest API: Geocodes ignored, Kansas used instead

Hello,

I am trying to get driving directions between two Canadian locations.

The problem is, no matter what I put for the Latitude / Longitude of the destination, it always maps to Kansas!

What is wrong and how can I fix this?

Thanks!

PS.... You will have to upload this to a server to test it because MapQuest requires that it be accessed via http://




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-t...
<html>
<head>
<script type="text/javascript"
src="http://web.openapi.mapquest.com/oapi/tra...
</script>
<title>
Mapquest Routing
</title>
<script type="text/javascript">
var mqRoute = null;
function doSubmit()
{
mqRoute = new MQRoute("container");
var thumbSize = new MQSize();
thumbSize.setHeight(150);
thumbSize.setWidth(300);
var overviewSize = new MQSize();
overviewSize.setHeight(400);
overviewSize.setWidth(600);
mqRoute.primaryMapSize = overviewSize;
var myRoute = new MQRoute("container");
var myLoc = new MQLocation();
myLoc.setLatitude('45.409097');
myLoc.setLongitude('-75.685449');
myRoute.origin = myLoc;
myLoc.setLatitude('45.4237332');
myLoc.setLongitude('-75.676332');
myRoute.dest = myLoc;
myRoute.doRoute();
}
function routeReturn(mqRoute, status) {
}
</script>
</head>
<body>
<div class="mqClear">
<form id="ddform" name="ddform" action="javascript:doSubmit();"
class="mqDefault" title="Get Directions">
<input type="hidden" name="go" value="1" />
<input type="hidden" name="do" value="nw" />
<input type="hidden" name="rmm" value="1" />
<input type="hidden" name="un" value="m" />
<input type="hidden" name="cl" value="EN" />
<input type="hidden" name="ct" value="NA" />
<input type="hidden" name="rsres" value="1" />
<input type="hidden" name="map" value="y" />
<div style="text-align:center">
<input type="submit" id="submit1"
value="Get Directions" tabindex="20"/></div>
</form>
</div>
<div>
<div id="container" class="mqContainer" style="width:600px;">
</div></div>
</body>
</html>



Answer Discussion
Tutorials

 

Q&A System for Websites and Corporate Collaboration

Advertisement

  • Generates significant organic traffic for websites
  • Saves companies money, resources, and time

nidhi

Date:: Apr 12, 2007

Time:: 07:00

your code wont work for anyone cos the url is http://web.openapi.mapquest.com/oapi/tra... and I assume u need to have a key

Regarding setting destination, just a thought, try create another variable, does it make any difference?

eg
 var myLocDest = new MQLocation();
 myLocDest.setLatitude('45.4237332');
 myLocDest.setLongitude('-75.676332');
 myRoute.dest = myLocDest;

hopefully it will find Ottawa or something

nidhi

Date:: Apr 12, 2007

Time:: 07:03

Had a quick look in mapquest, it seems u need to set

myRoute.destination

and not myRoute.dest

I could be mistaken as I dont have that sdk
http://www.mapquest.com/features/main.ad...

admin

Date:: Jun 16, 2007

Time:: 16:09

hknight, please close this question and distribute the points.
If you didn't get a solution to your problem or you found it yourself, please leave a comment here to let the experts know.
Thanks,
Quomon Admin

admin

Date:: Jun 25, 2007

Time:: 06:09

The question has been closed.

Quomon Admin

Question Answered

This question has been closed, and points have been rewarded to the following experts:

nidhi: 250

You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

No tutorials have been submitted yet. Want to be the first?

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top JavaScript Experts

View More

Rank

Expert

Points

1.

nidhi

665

2.

rcastagna

505

3.

jgivoni

428

4.

xarcus

280

5.

theDude

200

6.

redcharcoal

125

7.

roger.berbel

125

8.

Anpanman

87

9.

john2

80

10.

joxley

75

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es