Google maps 谷歌地理编码API提供区域数据
我正在使用谷歌的API 我希望始终获得英语数据,而不是区域语言数据 我正在呼叫此链接并使用Google maps 谷歌地理编码API提供区域数据,google-maps,google-api,google-geocoding-api,regional,Google Maps,Google Api,Google Geocoding Api,Regional,我正在使用谷歌的API 我希望始终获得英语数据,而不是区域语言数据 我正在呼叫此链接并使用格式化的\u地址=लासुरगाव रोड, लसुर, महाराष्ट्र 423702,印度从结果键的第一个位置开始,该键为印地语,来自以下数据: { "plus_code" : { "compound_code" : "W2H6+3M Harsul, Maharashtra, India", "glo
格式化的\u地址=लासुरगाव रोड, लसुर, महाराष्ट्र 423702,印度从结果
键的第一个位置开始,该键为印地语,来自以下数据:
{
"plus_code" : {
"compound_code" : "W2H6+3M Harsul, Maharashtra, India",
"global_code" : "7JFQW2H6+3M"
},
"results" : [
{
"address_components" : [
{
"long_name" : "लासुरगाव रोड",
"short_name" : "लासुरगाव रोड",
"types" : [ "route" ]
},
{
"long_name" : "लसुर",
"short_name" : "लसुर",
"types" : [ "locality", "political" ]
},
{
"long_name" : "औरंगाबाद",
"short_name" : "औरंगाबाद",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "महाराष्ट्र",
"short_name" : "MH",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "India",
"short_name" : "IN",
"types" : [ "country", "political" ]
},
{
"long_name" : "423702",
"short_name" : "423702",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "लासुरगाव रोड, लसुर, महाराष्ट्र 423702, India",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 19.9279766,
"lng" : 75.011798
},
"southwest" : {
"lat" : 19.9276098,
"lng" : 75.0108685
}
},
"location" : {
"lat" : 19.9277932,
"lng" : 75.01133329999999
},
"location_type" : "GEOMETRIC_CENTER",
"viewport" : {
"northeast" : {
"lat" : 19.9291421802915,
"lng" : 75.0126822302915
},
"southwest" : {
"lat" : 19.9264442197085,
"lng" : 75.0099842697085
}
}
},
"place_id" : "ChIJRS92AquJ2zsRGIY8TmId5OQ",
"types" : [ "route" ]
},
{
"address_components" : [
{
"long_name" : "Lasur",
"short_name" : "Lasur",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Aurangabad",
"short_name" : "Aurangabad",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Maharashtra",
"short_name" : "MH",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "India",
"short_name" : "IN",
"types" : [ "country", "political" ]
},
{
"long_name" : "423702",
"short_name" : "423702",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "Lasur, Maharashtra 423702, India",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 19.9365397,
"lng" : 75.0198626
},
"southwest" : {
"lat" : 19.9104756,
"lng" : 74.99952089999999
}
},
"location" : {
"lat" : 19.9282261,
"lng" : 75.0114612
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 19.9365397,
"lng" : 75.0198626
},
"southwest" : {
"lat" : 19.9104756,
"lng" : 74.99952089999999
}
}
},
"place_id" : "ChIJqakxlFSI2zsRU2QZ0WNgCMQ",
"types" : [ "locality", "political" ]
},
{
"address_components" : [
{
"long_name" : "423702",
"short_name" : "423702",
"types" : [ "postal_code" ]
},
{
"long_name" : "Aurangabad",
"short_name" : "Aurangabad",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Maharashtra",
"short_name" : "MH",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "India",
"short_name" : "IN",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Maharashtra 423702, India",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 19.9812906,
"lng" : 75.14881470000002
},
"southwest" : {
"lat" : 19.7257081,
"lng" : 74.7853344
}
},
"location" : {
"lat" : 19.8539262,
"lng" : 74.9910112
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 19.9812906,
"lng" : 75.14881470000002
},
"southwest" : {
"lat" : 19.7257081,
"lng" : 74.7853344
}
}
},
"place_id" : "ChIJAVBUmAp43DsRAohUV0LQMO4",
"types" : [ "postal_code" ]
},
{
"address_components" : [
{
"long_name" : "Aurangabad",
"short_name" : "Aurangabad",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Maharashtra",
"short_name" : "MH",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "India",
"short_name" : "IN",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Aurangabad, Maharashtra, India",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 20.6673799,
"lng" : 76.04805
},
"southwest" : {
"lat" : 19.37426,
"lng" : 74.58680009999999
}
},
"location" : {
"lat" : 19.8910826,
"lng" : 75.1545381
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 20.6673799,
"lng" : 76.04805
},
"southwest" : {
"lat" : 19.37426,
"lng" : 74.58680009999999
}
}
},
"place_id" : "ChIJOV9BNoai2zsRtocWKbhGxs8",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"address_components" : [
{
"long_name" : "Maharashtra",
"short_name" : "MH",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "India",
"short_name" : "IN",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Maharashtra, India",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 22.028441,
"lng" : 80.890924
},
"southwest" : {
"lat" : 15.6024121,
"lng" : 72.659363
}
},
"location" : {
"lat" : 19.7514798,
"lng" : 75.7138884
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 22.028441,
"lng" : 80.890924
},
"southwest" : {
"lat" : 15.6024121,
"lng" : 72.659363
}
}
},
"place_id" : "ChIJ-dacnB7EzzsRtk_gS5IiLxs",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"address_components" : [
{
"long_name" : "India",
"short_name" : "IN",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "India",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 35.513327,
"lng" : 97.39535869999999
},
"southwest" : {
"lat" : 6.4626999,
"lng" : 68.1097
}
},
"location" : {
"lat" : 20.593684,
"lng" : 78.96288
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 35.513327,
"lng" : 97.39535869999999
},
"southwest" : {
"lat" : 6.4626999,
"lng" : 68.1097
}
}
},
"place_id" : "ChIJkbeSa_BfYzARphNChaFPjNc",
"types" : [ "country", "political" ]
}
],
"status" : "OK"
}
由于我不需要区域语言的数据,是否可以每次只获取英语数据
编辑:
我最近试过什么
- 在标题中通过
Accept Language=en
或Accept Language=en-US
,但不起作用
- 尝试使用
language=en
和hl=en
但不起作用
是否尝试添加区域参数:?我相信这可能是一种预期行为。谷歌在地理编码API响应中倾向于使用本地语言,因为本地语言与用户语言具有相同的字母表
下面的博客文章解释了这种行为
如果本地语言和用户语言都使用相同的字母表,那么地理编码API现在将返回街道和地方的本地名称。例如,在巴西搜索用户语言设置为英语的地址时,现在返回的是“Aventida Paulista”,而不是“Paulista Avenue”
如果本地语言和用户语言使用不同的字母,则地理编码API将返回本地名称,并将其音译为拉丁字母。在某些情况下,可能会返回英文译文,例如,如果没有音译。例如,用户语言设置为日语的El Tahrir Square搜索现在返回“El Tahrir Square,Ismailia,Qasr an Nile,开罗省,エジプト” 而不是“エジプト カイロ県 卡萨河,タハリール広場” (旧结果)或“旧结果”(当地名称)
也许谷歌检测到你的IP地址位于印度,所以回应倾向于使用当地语言
在我的情况下,当我从我在西班牙的所在地执行您的样本请求时,我得到以下英文回复
https://maps.googleapis.com/maps/api/geocode/json?latlng=22.9997%2C72.6354&key=MY_API_KEY
{
"plus_code":{
"compound_code":"XJXP+V5 Ahmedabad, Gujarat, India","global_code":"7JJJXJXP+V5"
},
"results":[
{
"address_components":[
{
"long_name":"BRTS Corridor",
"short_name":"BRTS Corridor",
"types":[
"route"
]
},
{
"long_name":"Rabari Colony",
"short_name":"Rabari Colony",
"types":[
"political","sublocality","sublocality_level_2"
]
},
{
"long_name":"Amraiwadi",
"short_name":"Amraiwadi",
"types":[
"political","sublocality","sublocality_level_1"
]
},
{
"long_name":"Ahmedabad",
"short_name":"Ahmedabad",
"types":[
"locality","political"
]
},
{
"long_name":"Ahmedabad",
"short_name":"Ahmedabad",
"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"
]
},
{
"long_name":"380008",
"short_name":"380008",
"types":[
"postal_code"
]
}
],
"formatted_address":"BRTS Corridor, Rabari Colony, Amraiwadi, Ahmedabad, Gujarat 380008, India",
"geometry":{
"bounds":{
"northeast":{
"lat":23.0048831,"lng":72.63708439999999
},
"southwest":{
"lat":22.9996702,"lng":72.6353833
}
},
"location":{
"lat":23.0022759,"lng":72.6362362
},
"location_type":"GEOMETRIC_CENTER",
"viewport":{
"northeast":{
"lat":23.0048831,"lng":72.6375828302915
},
"southwest":{
"lat":22.9996702,"lng":72.6348848697085
}
}
},
"place_id":"ChIJ9UjW5mqGXjkR2mRics2aU4I",
"types":[
"route"
]
},
{
"address_components":[
{
"long_name":"Rabari Colony",
"short_name":"Rabari Colony",
"types":[
"political","sublocality","sublocality_level_2"
]
},
{
"long_name":"Amraiwadi",
"short_name":"Amraiwadi",
"types":[
"political","sublocality","sublocality_level_1"
]
},
{
"long_name":"Ahmedabad",
"short_name":"Ahmedabad",
"types":[
"locality","political"
]
},
{
"long_name":"Ahmedabad",
"short_name":"Ahmedabad",
"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"
]
},
{
"long_name":"380038",
"short_name":"380038",
"types":[
"postal_code"
]
}
],
"formatted_address":"Rabari Colony, Amraiwadi, Ahmedabad, Gujarat 380038, India",
"geometry":{
"bounds":{
"northeast":{
"lat":23.009061,"lng":72.6454679
},
"southwest":{
"lat":22.9931311,"lng":72.6254739
}
},
"location":{
"lat":23.0019153,"lng":72.6343352
},
"location_type":"APPROXIMATE",
"viewport":{
"northeast":{
"lat":23.009061,"lng":72.6454679
},
"southwest":{
"lat":22.9931311,"lng":72.6254739
}
}
},
"place_id":"ChIJaY70lGuGXjkRp_Y5g5vavs4",
"types":[
"political","sublocality","sublocality_level_2"
]
},
{
"address_components":[
{
"long_name":"380026",
"short_name":"380026",
"types":[
"postal_code"
]
},
{
"long_name":"Ahmedabad",
"short_name":"Ahmedabad",
"types":[
"locality","political"
]
},
{
"long_name":"Ahmedabad",
"short_name":"Ahmedabad",
"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":"Ahmedabad, Gujarat 380026, India",
"geometry":{
"bounds":{
"northeast":{
"lat":23.0113677,"lng":72.6453252
},
"southwest":{
"lat":22.9891871,"lng":72.60732229999999
}
},
"location":{
"lat":23.0044623,"lng":72.62575869999999
},
"location_type":"APPROXIMATE",
"viewport":{
"northeast":{
"lat":23.0113677,"lng":72.6453252
},
"southwest":{
"lat":22.9891871,"lng":72.60732229999999
}
}
},
"place_id":"ChIJ89jUeXOGXjkRICMp0qh6yZg",
"types":[
"postal_code"
]
},
{
"address_components":[
{
"long_name":"Amraiwadi",
"short_name":"Amraiwadi",
"types":[
"political","sublocality","sublocality_level_1"
]
},
{
"long_name":"Ahmedabad",
"short_name":"Ahmedabad",
"types":[
"locality","political"
]
},
{
"long_name":"Ahmedabad",
"short_name":"Ahmedabad",
"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":"Amraiwadi, Ahmedabad, Gujarat, India",
"geometry":{
"bounds":{
"northeast":{
"lat":23.0137105,"lng":72.645556
},
"southwest":{
"lat":22.989467,"lng":72.61277
}
},
"location":{
"lat":22.9996728,"lng":72.635381
},
"location_type":"APPROXIMATE",
"viewport":{
"northeast":{
"lat":23.0137105,"lng":72.645556
},
"southwest":{
"lat":22.989467,"lng":72.61277
}
}
},
"place_id":"ChIJJTsGyhKGXjkR96JPXxPnU-4",
"types":[
"political","sublocality","sublocality_level_1"
]
},
{
"address_components":[
{
"long_name":"Ahmedabad",
"short_name":"Ahmedabad",
"types":[
"locality","political"
]
},
{
"long_name":"Ahmedabad",
"short_name":"Ahmedabad",
"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":"Ahmedabad, Gujarat, India",
"geometry":{
"bounds":{
"northeast":{
"lat":23.1378156,"lng":72.7053737
},
"southwest":{
"lat":22.9028759,"lng":72.4541115
}
},
"location":{
"lat":23.022505,"lng":72.5713621
},
"location_type":"APPROXIMATE",
"viewport":{
"northeast":{
"lat":23.1378156,"lng":72.7053737
},
"southwest":{
"lat":22.9028759,"lng":72.4541115
}
}
},
"place_id":"ChIJSdRbuoqEXjkRFmVPYRHdzk8",
"types":[
"locality","political"
]
},
{
"address_components":[
{
"long_name":"Ahmedabad",
"short_name":"Ahmedabad",
"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":"Ahmedabad, Gujarat, India",
"geometry":{
"bounds":{
"northeast":{
"lat":23.50846,"lng":72.84009999999999
},
"southwest":{
"lat":21.9817599,"lng":71.83994
}
},
"location":{
"lat":23.022475,"lng":72.5715183
},
"location_type":"APPROXIMATE",
"viewport":{
"northeast":{
"lat":23.50846,"lng":72.84009999999999
},
"southwest":{
"lat":21.9817599,"lng":71.83994
}
}
},
"place_id":"ChIJIxcnN0CEXjkRobQIMyNYLpI",
"types":[
"administrative_area_level_2","political"
]
},
{
"address_components":[
{
"long_name":"Gujarat",
"short_name":"GJ",
"types":[
"administrative_area_level_1","political"
]
},
{
"long_name":"India",
"short_name":"IN",
"types":[
"country","political"
]
}
],
"formatted_address":"Gujarat, India",
"geometry":{
"bounds":{
"northeast":{
"lat":24.705709,"lng":74.4764881
},
"southwest":{
"lat":20.127954,"lng":68.162834
}
},
"location":{
"lat":22.258652,"lng":71.1923805
},
"location_type":"APPROXIMATE",
"viewport":{
"northeast":{
"lat":24.705709,"lng":74.4764881
},
"southwest":{
"lat":20.127954,"lng":68.162834
}
}
},
"place_id":"ChIJlfcOXx8FWTkRLlJU7YfYG4Y",
"types":[
"administrative_area_level_1","political"
]
},
{
"address_components":[
{
"long_name":"India",
"short_name":"IN",
"types":[
"country","political"
]
}
],
"formatted_address":"India",
"geometry":{
"bounds":{
"northeast":{
"lat":35.513327,"lng":97.39535869999999
},
"southwest":{
"lat":6.4626999,"lng":68.1097
}
},
"location":{
"lat":20.593684,"lng":78.96288
},
"location_type":"APPROXIMATE",
"viewport":{
"northeast":{
"lat":35.513327,"lng":97.39535869999999
},
"southwest":{
"lat":6.4626999,"lng":68.1097
}
}
},
"place_id":"ChIJkbeSa_BfYzARphNChaFPjNc",
"types":[
"country","political"
]
}
],
"status":"OK"
}
因此,为了获得英文结果,您应该从您所在国家以外的服务器发送请求,例如从欧洲发送请求,或者尝试说服谷歌您位于印度以外(可能使用VPN)
我希望这有帮助
更新
https://maps.googleapis.com/maps/api/geocode/json?latlng=19.9276734%2C75.0116544&key=MY_API_KEY
还为我提供了印地语的结果
请注意,结果类型为“route”,地点Id为ChIJRS92AquJ2zsRGIY8TmId5OQ
如果我在地理编码工具中打开这个地方ID,文本也是印地语的
如果您执行place details requesthttps://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJRS92AquJ2zsRGIY8TmId5OQ&key=YOUR_API_KEY
你会在谷歌地图上看到这个地方的直接链接
谷歌地图中的文字也是印地语
它看起来像一个id为ChIJRS92AquJ2zsRGIY8TmId5OQ的地方,它代表了一条路线,在谷歌方面确实存在数据问题
我认为解决此问题的唯一方法是联系Google Maps API支持团队。希望他们能够帮助解决此数据问题。是否尝试添加语言参数:https://maps.googleapis.com/maps/api/geocode/json?latlng=22.9997%2C72.6354&language=en&key=YOUR_API_KEY
?指定语言的结果是否相同?是的,我尝试过hlanguage=en
也尝试了hl=en
,但得到了相同的结果。这听起来像是数据问题,我的意思是谷歌数据库中缺少翻译。尝试通过您的云项目界面联系谷歌地图支持。谢谢@xomena,实际上我在谷歌地图上搜索了这个地方。它以两种语言显示数据年龄英语和印地语。region
仅用于获得特定地区的结果。如果我们通过Rajkot
查找无地区,则将获得印度和巴基斯坦的结果,因为两国都有Rajkot
城市。如果我们通过region=IN,则只会获得印度的结果。非常感谢您的努力。有没有您尝试了latlong,我在这个latlong中得到了印地语。您使用的latlong在英语中给了我相同的结果。感谢您的更新。我已经联系了Google API团队,他们会让我知道的。再次感谢。