2014-11-14 4 views
0

Google지도에서 마커를 배치하는 방법에 대한 질문이 있습니다. 이 스크립트는 페이지로드 렌더 맵에서 그러나이 맵에 회사 로고를 넣고 싶습니다. 나는 방향이없는 초기지도를 원한다.마커 아이콘 길 찾기 google지도

src="https://maps.googleapis.com/maps/api/js?v=3&amp;sensor=false"></script><script type="text/javascript">// <![CDATA[ 
var map; 
     var directionsDisplay; 
     var manila = new google.maps.LatLng(55.009657,-1.450706); 
     var directionsService = new google.maps.DirectionsService(); 
     function initialize() { 
      // Make the route draggable 
      var rendererOptions = { 
       draggable: true,     
      } 
      directionsDisplay = new google.maps.DirectionsRenderer(rendererOptions); 
      var mapOptions = { 
       zoom:13, 
       mapTypeId: google.maps.MapTypeId.DRIVING, 
       center: manila, 
      } 

      map = new google.maps.Map(document.getElementById("map_canvas"),mapOptions); 
      directionsDisplay.setMap(map); 
      directionsDisplay.setPanel(document.getElementById("directionsPanel")); 

     } 

내가 알고 당신이 마커 객체를 생성 할 필요가지도에 아이콘이하기 위해 ...

var marker=new google.maps.Marker({ 
    position:manila, 
    icon:'image-link' 
    }); 

하고 매핑 설정이 마커 사용하기에 :

marker.setMap(map); 

을 하지만 지도에 개체를 전달할 수있는 marker.setMap(map); 대신 directionsDisplay.setMap(map);을 사용하고 있습니까?

+0

미안 해요, 난 이해가 안 돼요. 왜 둘 다 부를 수 없습니까? 하나는 아이콘을 추가하고 하나는 길 찾기를 표시합니다 – Mawg

답변

0

G.I.Y.F This page은 Google지도에 자신 만의 로고를 추가하는 방법을 설명합니다.

은 참조 : How to add logo to copyrights in google maps?

http://www.developerdrive.com/2013/08/adding-a-custom-icon-to-a-google-maps-marker/

는 등

+1

고마워요! 이것은 정확한 구매가 아니었다. 알아 냈어. –

+0

조금 도와줬으면 좋겠다. 보드에 오신 것을 환영합니다. 명확한 질문을 게시하면 항상 도움을 얻을 수 있습니다. 재미있어! – Mawg

관련 문제