谷歌的标记不是正确的地图

时间:2014-05-29 16:06:34

标签: google-maps google-maps-api-3 gmaps4rails

我使用谷歌地图为rails gem创建了一个谷歌地图。我正在使用自定义svg标记。

标记没有出现在正确的位置(参见附图中的达拉斯或芝加哥)。

在我的控制器中,我创建了一个哈希对象。我尝试使用marker_anchor属性调整标记的位置,但它似乎对图像在地图上的位置没有任何影响。我也尝试使用int 1-9格式或richmarker(即[1,true]),但这也不起作用。

@hash = Gmaps4rails.build_markers(@cities_for_map) do |city, marker|
  marker.lat city.latitude
  marker.lng city.longitude
  marker.picture({
    "url" => "/images/maps/regular.marker.svg",
    "width" => 13,
    "height" => 13,
    "marker_anchor" => [0, 50]
  })
  marker.infowindow render_to_string(:partial => "/destinations/map_tile.html", :locals => { :city => city})
end

我是在尝试修改错误的属性还是他们的宝石错误?

enter image description here

1 个答案:

答案 0 :(得分:0)

@apneadiving解决了这个问题

使用需要使用锚点,而不是marker_anchor。我假设我正在使用富有标记的库。