Google지도를 사용하고 있으며 사용자가 현재 위치를 사용하여 (지도에 배치 된) 마커 반경에 있는지 감지 할 수 있기를 원합니다. . 사용자에게 현재 위치 좌표 (위도와 경도)와 마커 좌표가 있지만 사용자가 해당 지역에 있는지 여부를 계산하는 방법을 알지 못합니다. 아래 그림은 내가하고 싶은 것을 가장 잘 묘사합니다.Android Google Map 사용자가 마커 서클 영역에 있는지 확인하는 방법
map.OnInfoWindowClickListener(new OnInfoWindowClickListener()){
public void isUserInArea(Marker marker){
float[] distance = new float[2];
//users current location
Location.distanceBetween(currentLocation.getLatitude(),currentLocatiocation.getLongitude(),
marker.getPosition().latitude, marker.getPosition().longitude, distance);
}
내가 마커 원의 보류를 얻을 수 없기 때문에 현재 위치가 표시 자 영역 내에있는 경우 발견하지 않습니다
는이 같은 알고리즘을 가지고있다. 그러나 내가 가지고있는 가장 가까운 곳이에요. 도와 주셔서 감사합니다.
Location.distanceBetween(mMarker.getPosition().latitude,
mMarker.getPosition().longitude, mCircle.getCenter().latitude,
mCircle.getCenter().longitude, distance);
if (distance[0] > mCircle.getRadius()) {
//Do what you need
}else if (distance[0] < mCircle.getRadius()) {
//Do what you need
}
신난다는 매력처럼 일했습니다! – Khateeb321
다른 사람이 답을 표시 할 수 있습니까? – Khateeb321