设置反向地理编码语言Gmaps v.3

时间:2013-02-11 15:24:57

标签: google-maps geocode

现在做任何人如何设置反向地理编码php响应的语言? (总是设置en)

**Here is the code**
<code>
$api_key = "***";

$url = 'http://maps.google.com/maps/geo?q=49.8411860,30.1066580&output=json&sensor=true_or_false&key=' . $api_key.'&language=uk';

$data = @file_get_contents($url);

$jsondata = json_decode($data,true);

if(is_array($jsondata )&& $jsondata ['Status']['code']==200) {
      $addr = $jsondata ['Placemark'][0]['address'];
}

echo $addr;
</code>
**The Output is**

"L'va Tolstoho street, Bila Tserkva, Kyivs'ka oblast, Ukraine"

1 个答案:

答案 0 :(得分:2)

如果您想要英语,请将您的URI变量语言更改为'en',即&amp; language = en

$url = 'http://maps.google.com/maps/geo?q=49.8411860,30.1066580&output=json&sensor=true_or_false&key=' . $api_key.'&language=en';

Google Maps API Localization Reference Guide

See the list of all language codes on wikipedia