【问题标题】:setting language for reverse geocoding Gmaps v.3为反向地理编码 Gmaps v.3 设置语言
【发布时间】:2013-02-11 15:24:56
【问题描述】:

现在有人如何为反向地理编码 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"

【问题讨论】:

    标签: google-maps geocode


    【解决方案1】:

    如果您想要英语,请将您的 URI 变量语言更改为“en”,即 &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

    【讨论】:

      猜你喜欢
      • 2016-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 2011-08-27
      • 2015-10-31
      相关资源
      最近更新 更多