【发布时间】:2013-01-15 18:12:14
【问题描述】:
我正在使用 gmaps4rails 在我的应用程序中显示 gmap。我正在正确获取地图点,但我无法区分我的地图中的当前位置和 nerby 位置。我的想法是对两个位置使用不同的标记,我在下面做了方式,但它对我没有用
我的控制器
def profile
@googlemaplocation=Location.find_by_id("#{params[:clinic_id]}")
@json1 = @googlemaplocation.to_gmaps4rails do |locations, marker|
marker.picture({
:picture => "http://www.google.com/mapfiles/dd-start.png",
:width => 32,
:height => 32
})
end
@neargooglemaplocation=@googlemaplocation.nearbys(10)
@json2= @neargooglemaplocation.to_gmaps4rails do |locations, marker|
marker.picture({
:picture => "http://www.google.com/mapfiles/dd-start.png",
:width => 32,
:height => 32
})
end
@json = (JSON.parse(@json1) + JSON.parse(@json2)).to_json
end
我的看法
<%= gmaps(:markers => { :data => @json } ) %>
如果我想在同一张地图上显示两个不同的标记该怎么办
感谢和问候 哈里·克里希纳
【问题讨论】:
-
可能是不同的图片?