본문 바로가기

Kotlin/안드로이드 공부

카카오맵 local api - rect 사용법

728x90

?rect="여기에 들어갈 것은 무엇인가?"

문서도 자세하지 않고, 개발자 포럼 답변도 뭔가 아리송했따.

여러번의 시도 끝에....

 

결론은 나는 이렇게 했다.

onMapViewMoveFinished에서

지도에서 손을 뗸 순간의 화면의 BottomLeft값과 TopRight값을 받아왔다.

그리고 각각 저장해주었다.

 

left = mapView.mapPointBounds.bottomLeft.mapPointGeoCoord.latitude.toString()
bottom = mapView.mapPointBounds.bottomLeft.mapPointGeoCoord.longitude.toString()
right = mapView.mapPointBounds.topRight.mapPointGeoCoord.latitude.toString()
top = mapView.mapPointBounds.topRight.mapPointGeoCoord.longitude.toString()

 

그리고 마커에 이렇게 넣었다.

rect = "${bottom},${left},${top},${right}"