Ruby on rails 如何使用gmap4rails添加Groundoverlay
使用gmap4rails,我在railsapplication中创建了一个带有一些标记的地图。现在我想在我创建的地图上添加一个自定义地图的地面覆盖。我在Google MAPS API()中找到了一些文档,但我无法找到正确的语法来使用gmap4rails实现这一点。现在有人知道怎么做了吗 到目前为止,我的代码是:Ruby on rails 如何使用gmap4rails添加Groundoverlay,ruby-on-rails,google-maps,Ruby On Rails,Google Maps,使用gmap4rails,我在railsapplication中创建了一个带有一些标记的地图。现在我想在我创建的地图上添加一个自定义地图的地面覆盖。我在Google MAPS API()中找到了一些文档,但我无法找到正确的语法来使用gmap4rails实现这一点。现在有人知道怎么做了吗 到目前为止,我的代码是: <% content_for(:after_js) do %> <%= javascript_tag do %> var strictBounds
<% content_for(:after_js) do %>
<%= javascript_tag do %>
var strictBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(52.346415, 4.853680),
new google.maps.LatLng(52.402162, 4.978654)
);
$(document).on('ready', function(){
handler = Gmaps.build('Google');
handler.buildMap({
internal: {id: 'map'},
provider: {
zoom: 13,
center: new google.maps.LatLng(52.373095,4.8909129,17),
mapTypeId: google.maps.MapTypeId.ROADMAP,
draggable: true,
styles: mapStyle
}
},
function(){
markers = handler.addMarkers(<%= raw @markers.to_json %>);
handler.bounds.extendWidth(markers);
handler.fitMapToBounds();
});
})
<% end %>
<% end %>
groundoverlay: {
options: {
url: "custommap.jpg",
bounds: {
sw: {
lat: 52.346415,
lng: 4.853680
},
ne: {
lat: 52.402162,
lng: 4.978654
}
},
opts: {
opacity: 1
}
}
}