setting language for reverse geocoding Gmaps v.3

好久不见. 提交于 2020-01-24 10:26:09

问题


do anybody now how to set language for reverse geocoding php response ? (always set 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:


If you want English then change your URI variable language to 'en' i.e. &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



来源:https://stackoverflow.com/questions/14815192/setting-language-for-reverse-geocoding-gmaps-v-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!