单张飞行对象标记图标

时间:2018-12-19 13:42:29

标签: javascript leaflet

我想在地图上显示飞行对象。在使用谷歌地图之前,这是可行的。但我想与Leaflet map一起使用。这里的问题是标记图标。如何将Google Maps图标更改为Leaflet图标?

Google地图图标

    var mrk = new google.maps.Marker({
      map: map,
      position: { lat: obj.lat, lng: obj.lng },
      icon: {
          path: "M510,255c0-20.4-17.85-38.25-38.25-38.25H331.5L204,12.75h-51l63.75,204H76.5l-38.25-51H0L25.5,255L0,344.25h38.25 l38.25-51h140.25l-63.75,204h51l127.5-204h140.25C492.15,293.25,510,275.4,510,255z",
          scale: 0.05,
          strokeWeight: 0.2,
          strokeColor: 'black',
          strokeOpacity: 1,
          fillColor: 'yellow',
          fillOpacity: 0.9,
          rotation: (obj.angle + 270) % 360
      },
      title: obj.title
     }); 

传单图标和js

    var mrk = L.marker([obj.lat, obj.lng], {
    draggable: true,                                        
    title: obj.title,
    icon: L.icon({
        path: "M510,255c0-20.4-17.85-38.25-38.25-38.25H331.5L204,12.75h-51l63.75,204H76.5l-38.25-51H0L25.5,255L0,344.25h38.25 l38.25-51h140.25l-63.75,204h51l127.5-204h140.25C492.15,293.25,510,275.4,510,255z",
        scale: 0.05,
        strokeWeight: 0.2,
        strokeColor: 'black',
        strokeOpacity: 1,
        fillColor: 'yellow',
        fillOpacity: 0.9,
        rotation: (obj.angle + 270) % 360
    })                                        
}).addTo($scope.map);    

0 个答案:

没有答案