KNNaviView에서 마커 추가

카카오내비 SDK와 관련된 질문과 답변을 올리는 카테고리입니다.

안녕하세요, 카카오내비 길찾기 SDK with UI 관련해서 문의드립니다.

KNNaviView를 사용해서 내비게이션 기능을 사용할 때, 지도의 특정 좌표에 도형이나 마커를 추가할 수 있는 방법이 있는지 궁금합니다.

문서를 보니 마커를 추가하는 기능은 KNMapView에서만 제공되는 것 같은데, KNNaviView의 지도 위에 마커를 그리는 방법은 없나요?

Currently, there is no direct method to add markers or shapes to the map while using KNNaviView in the current SDK version. This is because KNNaviView is specifically focused on providing a navigation experience.

Alternative solutions:

  1. KNMapView + KNNaviView Combination:

// Adding marker on KNMapView
let marker = KNMarker()
marker.coordinate = coordinate
mapView.addMarker(marker)

// Starting navigation
let naviView = KNNaviView()
// … navigation settings

  1. Custom Overlay Layer:
  • Add a transparent UIView over KNNaviView
  • Display your own markers on this view

let overlayView = UIView()
overlayView.backgroundColor = .clear
naviView.addSubview(overlayView)

// Adding custom marker
let markerView = UIImageView(image: markerImage)
markerView.frame = CGRect(x: x, y: y, width: width, height: height)
overlayView.addSubview(markerView)

  1. Pre-Navigation Marking:
  • Make your markings using KNMapView before starting navigation
  • Switch to KNNaviView when navigation begins

Recommendations:

  1. If markers are critical, consider using KNMapView instead
  2. You can request this feature on the Kakao Developers Forum
  3. Develop your own custom solution

Note: This feature might be added in future SDK versions, so I recommend keeping an eye on the Kakao Developers documentation for updates.

The limitation is due to KNNaviView being optimized for navigation purposes, while KNMapView is designed for more general map interactions including marker placement.

@Azeofsoup If you explain what you want to do with sample codes, I can give you better suggestions.