我有一個應用程序,它具有由用戶輸入的地址進行地理編碼的位置模型,現在我顯示給定地址的谷歌地圖,在地點實例中進行地理編碼,現在我想要do是在地圖上顯示foursquare地點及其地圖中顯示位置實例的圖標,我如何實現這一點,我已經在列表中獲取附近的場地,我如何使用它的圖標在地圖中顯示它們。添加foursquare場地以及實例gmaps4rails的位置
這是展示視圖和控制器中,我想看到的位置,例如加上附近的四方場地地圖...
def show
@location = Location.find(params[:id])
@json = Location.where('slug = ?', params[:id]).to_gmaps4rails
end
的觀點:
<% provide(:title, @location.name) %>
<% if [email protected]? %>
<%= content_tag(:div, "Location currently deactivated!", class: "alert") %>
<% end %>
<div class="row-fluid">
<aside class="span4" >
<section>
<h1>
<%= @location.name %>
</h1>
<%= gmaps({
"map_options" => { "auto_zoom" => false, "zoom" => 17 },
"markers" => { "data" => @json }
}) %>
</section>
</aside>
</div>
謝謝您的幫助!
你好,實際上進出口使用昆比和Im已經接到了場地陣列連接到Foursquare和東西,即有被添加這些場館標記來創建地圖標記一個gmaps4rails IM的問題對於一個位置的實例... – maumercado
只是合併這兩個數組。如果您需要不同的標記,請參閱http://stackoverflow.com/questions/5666173/google-maps-js-api-v3-simple-multiple-marker-example-with-custom-markers –
它不起作用,因爲位置類我在我的應用程序中有act_as_gmappable,但foursquare對象不能通過gmaps4rails映射 – maumercado