1

I have a site implementing "Google Map API v3" to create a map with pushpins of the yoga studios in our DB. Unfortunately, the locations are all in Japan. We have the addresses in English and Japanese, however, Google Maps is not so flexible with Japanese addresses in English and our DB of addresses is not the cleanest, so sometimes addresses do not display properly. Our addresses in Japanese characters (kanji) are probably fine and I would like to use them, so here is the problem...

When using addresses in kanji with the Google Map API, the maps shows completely wrong locations. But when I input the same address manually in Google Maps, it accurately delivers.

Is there a language setting or something?

Thank you.


Update and another question...

I figured out how to get the correct locations onto the map by editing the 'GoogleMapAPIv3.class.php' file here:

public function geocoding($address)
{
    $encodeAddress = urlencode($this->withoutSpecialChars($address));
    $url = "http://maps.google.com/maps/geo?q=".$encodeAddress."&output=csv";

...etc...

Changed the '$url...' line to:

$url = "http://maps.google.com/maps/geo?q='".$address."'&output=csv";

To make the function just use the inputted address as is. My question is, will that cause any problems with anything else?

Keep in mind this map function is only used to map locations residing in our DB, so the addresses are only limited to what is there. i.e. no random user input.

Thanks again.

Matt
  • 22,721
  • 17
  • 71
  • 112
Dorshin
  • 135
  • 2
  • 15
  • which charset do you use? Can you give an example for an address? – Dr.Molle Jan 19 '13 at 03:29
  • an example address would be: 東京都豊島区要町 – Dorshin Jan 19 '13 at 06:46
  • This returns the same result for me when using Google Maps and an own geocoder, Kanamecho, Toshima, Tokio, Japan. Does your DB and the DB-connection also use UTF8? – Dr.Molle Jan 19 '13 at 10:57
  • I double checked and made sure everything was set to utf8. Still not working. This address - 東京都調布市国領町 comes out to somewhere in Rome, Italy. Strange... – Dorshin Jan 19 '13 at 13:12
  • This is a link to the page: http://www.helloyoga.org/new_studios/ keep in mind it's not a live site yet, so the data is only there for testing. – Dorshin Jan 19 '13 at 13:47
  • have you tried region biasing? in the request object in the addDirection function you can add region:"JP" along with origin,destination and travel mode. – Ataur Rahim Chowdhury Jan 20 '13 at 07:00
  • What does your encoded URL look like? You can use https://google-developers.appspot.com/maps/documentation/utils/geocoder/ to test the addresses. – Wolf Bergenheim Jan 29 '18 at 23:43

1 Answers1

0

change $url = "http://maps.google.com/maps/ to $url = "https://google.co.jp/maps/ and if you want you can add language=ja at the end so that the language is japanese for example: https://google.co.jp/maps/api/js?language=ja

https://developers.google.com/maps/documentation/javascript/examples/map-language and https://google.co.jp/maps/ is google maps on Japan