我正在使用Google 的GeoCoding API。
我想始终获取英语数据而不是区域语言数据。
我正在调用此API链接,并从以下数据的印地语中键的第一个位置获取formatted_address
= लासुरगाव रोड, लसुर, महाराष्ट्र 423702, India :results
{
"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"
}
是否可以English
只获取每次数据,因为我不想要区域语言的数据?
编辑:
我最近尝试了什么?
- 通过
Accept-Language=en
或Accept-Language=en-US
在标头中但不工作。 - 尝试过
language=en
但hl=en
不工作。