印度的 LatLngBounds 是什么?
What are the LatLngBounds for India?
我在我的 android 应用程序中使用自动完成地点小部件。我只想将界限设置为印度。但我不知道印度的 LatLngBounds。有人知道坐标吗?
你可以用这个..
private static final LatLngBounds BOUNDS_INDIA = new LatLngBounds(new LatLng(23.63936, 68.14712), new LatLng(28.20453, 97.34466));
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Kolka&country=IN&key=YOUR_API_KEY
从 google 控制台创建服务器密钥
https://console.developers.google.com/apis/credentials
如果你想覆盖整个印度(虽然它也会覆盖中国、巴基斯坦和孟加拉国的部分地区),请使用以下界限:-
public static final LatLngBounds BOUNDS_INDIA = new LatLngBounds(new LatLng(7.798000, 68.14712), new LatLng(37.090000, 97.34466));
根据 google 文档:-
public LatLngBounds (LatLng southwest, LatLng northeast)
Creates a new bounds based on a southwest and a northeast corner.
The bounds conceptually includes all points where:
1. the latitude is in the range [northeast.latitude, southwest.latitude];
2. the longitude is in the range [southwest.longtitude, northeast.longitude] if southwest.longtitude ≤ northeast.longitude;
查找任意地点的经纬度
使用:- http://www.findlatitudeandlongitude.com/
您可以使用此方法获取任何国家/地区的边界 API
https://maps.googleapis.com/maps/api/geocode/json?key=YOUR_API_KEY&address=india
把你的钥匙放在YOUR_API_KEY的地方,地址放在国家
你会得到类似这样的回复
{
"results" : [
{
"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"
}
在几何边界中,您可以使用西南边界和东北边界,只需使用它们
private static final LatLngBounds BOUNDS_INDIA = new LatLngBounds(
new LatLng(6.4626999, 68.1097),
new LatLng(35.513327, 97.39535869999999)
);
我在我的 android 应用程序中使用自动完成地点小部件。我只想将界限设置为印度。但我不知道印度的 LatLngBounds。有人知道坐标吗?
你可以用这个..
private static final LatLngBounds BOUNDS_INDIA = new LatLngBounds(new LatLng(23.63936, 68.14712), new LatLng(28.20453, 97.34466));
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Kolka&country=IN&key=YOUR_API_KEY
从 google 控制台创建服务器密钥 https://console.developers.google.com/apis/credentials
如果你想覆盖整个印度(虽然它也会覆盖中国、巴基斯坦和孟加拉国的部分地区),请使用以下界限:-
public static final LatLngBounds BOUNDS_INDIA = new LatLngBounds(new LatLng(7.798000, 68.14712), new LatLng(37.090000, 97.34466));
根据 google 文档:-
public LatLngBounds (LatLng southwest, LatLng northeast)
Creates a new bounds based on a southwest and a northeast corner.
The bounds conceptually includes all points where:
1. the latitude is in the range [northeast.latitude, southwest.latitude];
2. the longitude is in the range [southwest.longtitude, northeast.longitude] if southwest.longtitude ≤ northeast.longitude;
查找任意地点的经纬度 使用:- http://www.findlatitudeandlongitude.com/
您可以使用此方法获取任何国家/地区的边界 API
https://maps.googleapis.com/maps/api/geocode/json?key=YOUR_API_KEY&address=india
把你的钥匙放在YOUR_API_KEY的地方,地址放在国家
你会得到类似这样的回复
{
"results" : [
{
"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"
}
在几何边界中,您可以使用西南边界和东北边界,只需使用它们
private static final LatLngBounds BOUNDS_INDIA = new LatLngBounds(
new LatLng(6.4626999, 68.1097),
new LatLng(35.513327, 97.39535869999999)
);