gpt4 book ai didi

java - 如何检查 Lat Long 在特定城市内?

转载 作者:太空宇宙 更新时间:2023-11-03 11:01:47 25 4
gpt4 key购买 nike

我想检查我的经纬度是否属于特定城市。我从 placeAutoComplete.IntentBuilder

收到我的纬度和经度
try {
Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
.setBoundsBias(new LatLngBounds(
new LatLng(Double.valueOf(18.5204), Double.valueOf(73.8567)),
new LatLng(Double.valueOf(18.5204), Double.valueOf(73.8567))))
.build(CheckOut.this);

startActivityForResult(intent, 1);
} catch (GooglePlayServicesRepairableException e) {
// TODO: Handle the error.
} catch (GooglePlayServicesNotAvailableException e) {
// TODO: Handle the error.
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if (resultCode == RESULT_OK) {
Place place = PlaceAutocomplete.getPlace(this, data);
Log.i("place", "Place: " + place.getLatLng());
LatLng placeLatLong= place.getLatLng();
user_lat = String.valueOf(placeLatLong.latitude);
user_long = String.valueOf(placeLatLong.longitude);
tvAddress2Popup.setText(String.valueOf(place.getName()));
} else if (resultCode == PlaceAutocomplete.RESULT_ERROR) {
Status status = PlaceAutocomplete.getStatus(this, data);
// TODO: Handle the error.
Log.i("", status.getStatusMessage());
} else if (resultCode == RESULT_CANCELED) {
// The user canceled the operation.
}
}
}

请给我解决方案

最佳答案

我想你可以试试下面的 google api,你会得到所有特定地点的详细信息

https://maps.googleapis.com/maps/api/place/details/json?placeid=xxxx&key=APi_key

关于java - 如何检查 Lat Long 在特定城市内?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40647683/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com