Krish KvR
Krish KvR

Reputation: 1054

Google Directions Service API 3 Return Wrong Result to Map

Am Using google Direction Service to find map the Two Address stated Below

var start = "2115 First Avenue SE Unit 1306, Cottage Grove Place, Cedar Rapids, IA, 52402";     //Set the source/ origin
var end = "6126 Rockwell Dr. Apt 128, Keystone Place, Cedar Rapids, IA, 52402";

On select it Via Google maps Direction directly it works fine

Link :https://www.google.co.in/maps/dir/Keystone+Place-Blair's+Ferry,+6126+Rockwell+Drive+Northeast,+Cedar+Rapids,+IA+52402,+United+States/Cottage+Grove+Place,+2115+1st+Avenue+Southeast,+Cedar+Rapids,+IA+52402,+United+States/@42.0179234,-91.6739759,13z/data=!3m1!4b1!4m13!4m12!1m5!1m1!1s0x87e4f0459aacb105:0x63c416fc0edc61d6!2m2!1d-91.6475339!2d42.039779!1m5!1m1!1s0x87e4f0d795c1b96b:0xa1ccbbf6400b01aa!2m2!1d-91.6362972!2d41.9959428?hl=en

It not working as same while using Direction Service. Find below example

http://jsfiddle.net/MRHQ4/291/ (Credits to Author :Shreerang Patwardhan)

It works fine when i remove Address2 from Source and Destination

Upvotes: 1

Views: 426

Answers (2)

Kashif Siddiqui
Kashif Siddiqui

Reputation: 38

'Cottage Grove Place' and 'Keystone Place' are not the address2, these are place names (or you can say place title), just move them to start of the address (no other change) like following, and it is working fine:

var start = "Cottage Grove Place, 2115 First Avenue SE Unit 1306, Cedar Rapids, IA, 52402";     //Set the source/ origin

var end = "Keystone Place, 6126 Rockwell Dr. Apt 128, Cedar Rapids, IA, 52402";  //Set the destination

I tested and it is working fine, please review, thanks.

Upvotes: 0

Tah
Tah

Reputation: 1536

Unit and apartment information can cause parsing issues in the geocoder. If you can, try to remove them as best as possible. Change the addresses to

var start = "2115 First Avenue SE, Cedar Rapids, IA, 52402";     //Set the source/ origin
var end = "6126 Rockwell Dr, Cedar Rapids, IA, 52402";

and you'll see it working better.

Reduced Address Information

With Neighborhood Information

With Apt/Unit Information

Upvotes: 1

Related Questions