2013-05-21 6 views
1

소매점 위치가있는 마커가 포함 된 Google지도가 있습니다.변경된지도에 마커를 동적으로 추가 - Google지도 API

잘 작동합니다.

사용자가 드래그 앤 드롭하여지도 포커스를 변경하는 경우 (지도 추출 변경) 이지도 추출물에 상점이 있으면 동적으로 새 아이콘을 추가하고 싶습니다.

나는 그런 예나 다른 것을 어디서 발견하는지 전혀 모른다.

+0

는 http://stackoverflow.com/questions/8865235/how-to-dynamically-change-a-google-maps-marker-를 보라 after-the-added 및 http://stackoverflow.com/questions/7844626/dynamically-add-google-map-v3-markers-using-jquery –

답변

2

먼저 마커의 초기 배치를로드 한 다음 "bounds_changed" 이벤트를 수신해야합니다. 해당 이벤트가 발생하면 새 좌표 및 줌 레벨과로드 마커를 가져옵니다.

당신은 여기에서 예를 찾을 수 있습니다

: https://developers.google.com/maps/documentation/javascript/events

google.maps.event.addListener(map, 'bounds_changed', function() { 
    //Get the new location and zoom parameters 
    //and print the new markers 
});