Javascript gmaps4rails中的自定义标记赢得';不出现

Javascript gmaps4rails中的自定义标记赢得';不出现,javascript,ruby-on-rails,google-maps,google-maps-markers,gmaps4rails,Javascript,Ruby On Rails,Google Maps,Google Maps Markers,Gmaps4rails,我尝试按照中的指南进行操作,但是我的自定义图标仍然无法加载 @hash = Gmaps4rails.build_markers(@terminals) do |terminal, marker| marker.lat terminal.latitude marker.lng terminal.longitude marker.picture({ "url" => "/assets/marker.png",

我尝试按照中的指南进行操作,但是我的自定义图标仍然无法加载

 @hash = Gmaps4rails.build_markers(@terminals) do |terminal, marker|
          marker.lat terminal.latitude
          marker.lng terminal.longitude
         marker.picture({
            "url" => "/assets/marker.png",
            "width" =>  30,        
            "height" => 30
            })
        end
image marker.png位于资源/图像中

构建地图:

<script type="text/javascript">
handler = Gmaps.build('Google');
handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
  markers = handler.addMarkers(<%=raw @hash.to_json %>);
  handler.bounds.extendWith(markers);
  handler.fitMapToBounds();
  handler.getMap().setZoom(13);
  handler.getMap().setOptions({styles: [{"featureType":"water","stylers":[{"saturation":43},{"lightness":-11},{"hue":"#0088ff"}]},{"featureType":"road","elementType":"geometry.fill","stylers":[{"hue":"#ff0000"},{"saturation":-100},{"lightness":99}]},{"featureType":"road","elementType":"geometry.stroke","stylers":[{"color":"#808080"},{"lightness":54}]},{"featureType":"landscape.man_made","elementType":"geometry.fill","stylers":[{"color":"#ece2d9"}]},{"featureType":"poi.park","elementType":"geometry.fill","stylers":[{"color":"#ccdca1"}]},{"featureType":"road","elementType":"labels.text.fill","stylers":[{"color":"#767676"}]},{"featureType":"road","elementType":"labels.text.stroke","stylers":[{"color":"#ffffff"}]},{"featureType":"poi","stylers":[{"visibility":"off"}]},{"featureType":"landscape.natural","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#b8cb93"}]},{"featureType":"poi.park","stylers":[{"visibility":"on"}]},{"featureType":"poi.sports_complex","stylers":[{"visibility":"on"}]},{"featureType":"poi.medical","stylers":[{"visibility":"on"}]},{"featureType":"poi.business","stylers":[{"visibility":"simplified"}]}]});
});
</script>

handler=Gmaps.build('Google');
buildMap({provider:{},internal:{id:'map'}},function(){
markers=handler.addMarkers();
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
handler.getMap().setZoom(13);
handler.getMap().setOptions({styles:[{“featureType”:“water”,“stylers”:[{“saturation”:43},{“lightness”:-11},{“hue”:“#0088ff”}},{“featureType”:“road”,“elementType”:“geometry.fill”,“stylers”:[{“hue”:“#ff0000”},{“saturation”:-100},{“lightness”:99},{“featureType”:“road”,“elementType”:“geometry.stroke”,“stylers”:“color”:“color”{8080},{},{“featureType”:“景观.人造”,“元素类型”:“几何体.填充”,“样式器”:[{“颜色”:“#ece2d9”}],{“特征类型”:“poi.park”,“元素类型”:“几何体.填充”,“样式器”:[{“颜色”:“#ccdca1”}],{“特征类型”:“道路”,“元素类型”:“标签.文本.填充”,“样式器”:[“颜色”:“{”76767676”},{“特征类型”:“道路”,“元素类型”:“标签.文本.笔划”,“样式器”:[{“颜色”:“#ffffff”},{“特征类型”:“poi”,“样式器”:[{“可见性”:“off”}]},{“特征类型”:“景观.自然”,“元素类型”:“几何.填充”,“样式器”:[{“可见性”:“on”},{“颜色”:“#b8cb93”},{“特征类型”:“poi.公园”,“样式器”:[{“可见性”:“on”},{“特征类型”:“poi.运动场馆”,“样式器”:“可见性”{“on”},{“医学特征类型”:“,”样式器“:[{”可见性“:”on“}]},{”特性类型“:”poi.business“,”样式器“:[{”可见性“:”simplified“}]}”);
});
地图:

    <div id="map"class="col-md-8" style="height: 100vh; background-color: #E4E2E1;">
    </div>

它是如何出现的:

控制器中没有marker.picture时的外观:

尝试将您的
标记更改为:

marker.picture({
   url: ActionController::Base.helpers.asset_path('marker.png'),
   width:  '30',        
   height: '30'
})
如果可以帮助您,请选中此项:)