簡體   English   中英

如何在Google地圖上顯示自己的圖像作為標記? gmaps4rails 2

[英]How to show own image as marker on google map ? gmaps4rails 2

gmaps4rails 2 + rails 4

def CommonUtils.get_gmap_hash(object)
     Gmaps4rails.build_markers(object) do |user, marker|
         marker.lat user.latitude
         marker.lng user.longitude
         marker.infowindow user.location
         binding.pry
         marker.picture({
            :picture => "/img/blank.png",
            :width   => 32,
            :height  => 32
            })
         marker.json({:title => user.title})
      end
  end

在這里marker.picture方法沒有擊中自己不知道為什么? 有什么幫助嗎?

和默認標記即將到來,我想要不同的標記(blank.png)。

blank.png在資產/圖片/img/blank.png中

根據消息來源 ,請執行以下操作:

 Gmaps4rails.build_markers(object) do |user, marker|
     marker.lat user.latitude
     marker.lng user.longitude
     marker.infowindow user.location
     marker.picture({
        :url     => "/img/blank.png",
        :width   => 32,
        :height  => 32
        })
     marker.json({:title => user.title})
  end

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM