Geocode api map address in local language
Asked Answered
R

2

9

I am newbie for the google apis. I was trying to get a full address for search keyword using this

http://maps.googleapis.com/maps/api/geocode/json?address=surat&sensor=false

using this I got the result like this

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Surat",
               "short_name" : "Surat",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Surat",
               "short_name" : "Surat",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "Gujarat",
               "short_name" : "GJ",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "India",
               "short_name" : "IN",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "Surat, Gujarat, India",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 21.2705834,
                  "lng" : 72.9432106
               },
               "southwest" : {
                  "lat" : 21.0478169,
                  "lng" : 72.70155579999999
               }
            },
            "location" : {
               "lat" : 21.1702401,
               "lng" : 72.83106070000001
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 21.2705834,
                  "lng" : 72.9432106
               },
               "southwest" : {
                  "lat" : 21.0478169,
                  "lng" : 72.70155579999999
               }
            }
         },
         "types" : [ "locality", "political" ]
      }
   ],
   "status" : "OK"
}

So I get the address but I want that adderss in local language.

For eg for above I want address in hindi language but if I search for berlin then I want address in german language.

Does anyone know how it is possible.

Thank you.

Raconteur answered 12/9, 2014 at 11:57 Comment(0)
G
7

Unfortunately it is not possible to get the results automatically in the results'country language.

As a workaround, if you know in advance the country you are looking for, then you are able to get the results in this country language by addind &language=XX at the end of your request:

See SO question Google Maps API v3.5 Geocoder language option

Here for your request, in hindi:

http://maps.googleapis.com/maps/api/geocode/json?address=surat&sensor=false&language=hi

Supported languages: https://spreadsheets.google.com/pub?key=p9pdwsai2hDMsLkXsoM05KQ&gid=1 (from here)

Glidewell answered 12/9, 2014 at 13:30 Comment(2)
thank you for answer but I know this already and it does not fit exactly to my current situation. I was just searching that if I can get language code with city name then also goodRaconteur
I know it is not the solution for your request as you were looking for the API response in the destination language and it is not possible. For the language code in the answer, it is also not the result you got, you only code the country codeGlidewell
D
1

To my understanding, the Google Map address data is in English. The address search auto-completion will match the text in the language you provide. There isn't an attribute for controlling output data language.

Dapplegray answered 26/6, 2015 at 19:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.