Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Ruby-带有徽标的自定义标记(谷歌地图)_Html_Css_Ruby On Rails_Google Maps_Google Maps Markers - Fatal编程技术网

Html Ruby-带有徽标的自定义标记(谷歌地图)

Html Ruby-带有徽标的自定义标记(谷歌地图),html,css,ruby-on-rails,google-maps,google-maps-markers,Html,Css,Ruby On Rails,Google Maps,Google Maps Markers,您好,能帮上忙的人 目前,我正在开发谷歌地图,该地图将有多个标记,但每个标记都将是唯一的,并在原地有一个公司徽标。标记的背景将始终相同 下面是一个快速模拟如何标记应该看起来 基本知识: 相同背景 每个公司都有独特的徽标(注意,会有很多公司) 该公司的标志以方形加载,并将落在蓝色标记后面(因此,不介意隐藏标志的某些部分) Ruby代码 在map.html.erb中显示地图标记 var location = new google.maps.LatLng(data[i]['latitude'],

您好,能帮上忙的人

目前,我正在开发谷歌地图,该地图将有多个标记,但每个标记都将是唯一的,并在原地有一个公司徽标。标记的背景将始终相同

下面是一个快速模拟如何标记应该看起来

基本知识:

  • 相同背景
  • 每个公司都有独特的徽标(注意,会有很多公司)
  • 该公司的标志以方形加载,并将落在蓝色标记后面(因此,不介意隐藏标志的某些部分)
  • Ruby代码

    在map.html.erb中显示地图标记

     var location = new google.maps.LatLng(data[i]['latitude'], data[i]['longitude'])
     bounds.extend(location);
    
    marker = new google.maps.Marker({
    position: location,
    map: map,
    icon:data[i]['image'],
    url:data[i]['link']
      });
    
    调用数据的Controller.rb

      def search
        @collection =  @tours.map do |t|
            {"name"=>t.host.company_name,"latitude"=>t.host.latitude,"longitude"=>t.host.longitude,"image"=>t.host.company_logo.url(:thumb),"link"=>host_show_path(t.host.id)}.to_json if t.host.latitude.present? && t.host.longitude.present?
        end
    
    地图正在运行,并且已经拉出了显示的公司(主机)徽标

    现在只需要获得一般背景

    希望有人能帮忙,但不知道怎么做


    谢谢

    您可以使用rmagick gem使用这两个图像生成所需的图像。@Sajin感谢您分享此信息,尽管不确定从何处开始,并将查找教程