2017-11-02 1 views
0

지도에서 회사의 맞춤 아이콘을 표시해야합니다. 나는 인터넷 검색 및 RichMarker이 hereGoogle지도의 기본 마커 대신 맞춤 아이콘을 표시하는 방법

제안 다음은 내가 이미 시도 어떤 것을 할 수 있다는 것을 알게되었습니다

if (GoogleMap === false) { 
     console.log(GoogleMap); 
     $.getScript("https://maps.google.com/maps/api/js?key=MyKey&sensor=false&libraries=places,geometry") 
      .done(function (script, textStatus) { 
       initializeGoogleMap(); 
       GoogleMap = true; 
      }); 
    }else{ 
     initializeGoogleMap(); 
    } 
} 

function initializeGoogleMap(){ 

var myLoc, map; 

myLoc = {lat: 34.640765, lng: 50.874745}; 
map = new google.maps.Map(document.getElementById('map'), { 
    zoom: 16, 
    center: myLoc 
}); 

var Marker = new google.maps.RichMarker({ 
    position: myLoc, 
    map: map, 
    content: "<i class='WMi-check'></i>" 
}); 
} 

하지만 맵에서 아무 것도 얻을 수 없습니다. 도와주세요. 대신 구글지도 기본 마커의

+1

는 대신 RichMarker의, 마커에서 "iconUrl"또는 "아이콘"매개 변수를 시도? 감사합니다. https://developers.google.com/maps/documentation/javascript/markers?hl=fr – andrea06590

+0

@ Westi-Tech 예, 있습니다. 그런 식으로 작동합니다. 그러나 현재 나는이 방법이 필요하다. – goseo

+1

@AfghanDeveloper 고객 이미지 아이콘이있는 기본 마커를 사용해 보셨습니까? – krishnar

답변

0

디스플레이 사용자 정의 아이콘

  var car = "M17.402,0H5.643C2.526,0,0,3.467,0,6.584v34.804c0,3.116,2.526,5.644,5.643,5.644h11.759c3.116,0,5.644-2.527,5.644-5.644 V6.584C23.044,3.467,20.518,0,17.402,0z M22.057,14.188v11.665l-2.729,0.351v-4.806L22.057,14.188z M20.625,10.773 c-1.016,3.9-2.219,8.51-2.219,8.51H4.638l-2.222-8.51C2.417,10.773,11.3,7.755,20.625,10.773z M3.748,21.713v4.492l-2.73-0.349 V14.502L3.748,21.713z M1.018,37.938V27.579l2.73,0.343v8.196L1.018,37.938z M2.575,40.882l2.218-3.336h13.771l2.219,3.336H2.575z M19.328,35.805v-7.872l2.729-0.355v10.048L19.328,35.805z"; 

      var icon = { 
       path: car, 
       scale: .7, 
       strokeColor: 'white', 
       strokeWeight: .10, 
       fillOpacity: 1, 
       fillColor: '#404040', 
       offset: '5%', 
       anchor: new google.maps.Point(10, 25) 
      }; 

      marker = new google.maps.Marker({ 
        position: new google.maps.LatLng(locations[i]['LAT'], locations[i]['LON']), 
        map: map, 
        icon: icon, 
       }); 
+0

솔직히 말해서 나는 주어진 아이콘을 사용하는 것만 허용되었으므로 이것을 시도하지 않았습니다. – goseo

관련 문제