[FAQ] 지도/로컬 API 문의 전 꼭 읽어 주세요.
기본 사항
로컬 (REST) API 에 대한 설명은 로컬 API 가이드 를 참고하세요.
지도 SDK에 대한 설명은 Kakao Map API 가이드 를 참고하세요.
카카오맵 API 사용 시 활용할 수 있는 카카오맵 아이콘 이미지는
Kakao Map 리소스 페이지에서 다운받울 수 있습니다.
로컬 API의 주소검색 기능과 당사가 별도로 제공하는 우편번호 서비스는 서로 다른 서비스 입니다.
우편번호 서비스 사용과 관련해서는 이곳에서 대응해드리기 어려우며
우편번호 서비스 가이드 내 “문의하기” 를 이용해주세요.
문의글 작성은
꼭 현재 사용 중인 앱키를 등록한 계정으로 해주셔야 정확한 안내가 가능합니다.
또한 서비스 소유자/회사와 계정 소유자가 동일하거나 소속관계가 확인되어야 정확한 안내/대응이 가능합니다.
문의하시기 전에 이곳 DevTalk의 게시글 검색을 통해
유사 문의에 대한 답변을 먼저 찾아보시면 더 빠르게 문제 해결이 가능할 수 있습니다. …
현재 next.js 애플리케이션에 카카오맵 api 사용중이고, 카카오맵 타입 관련해서 라이브러리를 사용하고 있습니다.(kakao.maps.d.ts)
현재 진행중인 서비스가, 첫 지도 로딩 시 서버에서 가져온 정보를 반복문을 돌며 마커에 연결시켜야하는데, 따로 프로퍼티를 마커에 부여할 수 있는 방법이 있는지 궁금합니다.
현재 대안으로 setTitle에 정보를 저장하고 getTitle로 정보를 사용하는데, 문제는 마우스를 호버하면 툴팁이 떠서 저장한 정보가 노출이 되고 있습니다. 그래서 새로운 방법을 아예 찾고자 질문을 드립니다.
별도로 속성을 추가하는 기능은 제공하고 있지 않습니다.
맵핑 테이블을 활용해서 마커와 데이터 정보를 관리하는 방법도 있으니 참고 부탁드립니다.
let items = {
'id1': {marker: marker, data: /*….*/},
'id2': {marker: marker, data: /*….*/},
/* … */
}
Hello, @신명희1281
Managing Multiple Markers with an Array If you use multiple markers on the map, you can add custom data to it and store it in an array.
const markers = [];
const locations = [
{ lat: 37.5665, lng: 126.9780, name: "Seoul", description: "Seoul," },
{ lat: 35.1796, lng: 129.0756, name: "Busan", description: "Busan" }
];
locations.forEach((location, index) => {
const marker = new kakao.maps.Marker({
position: new kakao.maps.LatLng(location.lat, location.lng)
});
// Add custom data to the marker
marker.customData = {
id: index,
name: location.name,
description: location.description
};
markers.push(marker); // Add markers to the array
// Display marker information when clicked
kakao.maps.event.addListener(marker, 'click', function() {
console.log("Selected Marker Information:", marker.customData);
});
});
i I hope this is useful to you.
Wow. Thank you so much…! Thanks to you, I was able to solve this problem… You’ve been such a huge help. THANK YOU !
Hello, I’m glad I could help. If you have any questions, tag me and I’ll help you.
@신명희1281
If you want to add more details, write what you want to add here and I will send you a new code.
Thank you so much for being so helpful and supportive! Everything is working great now. I truly appreciate your kindness in offering further assistance!
I hope you have a great weekend as well ! Thank you !!