Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting language for reverse geocoding Gmaps v.3

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"
like image 779
Swyst Avatar asked Mar 23 '26 03:03

Swyst


1 Answers

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

like image 94
Taylor H. Avatar answered Mar 25 '26 16:03

Taylor H.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!