gmaps4rails无法呈现自定义标记图像

时间:2012-11-19 14:38:47

标签: ruby-on-rails-3 google-maps gmaps4rails

我的地图上有4种类型的标记,我根据它的“学校类型”为每个点加载图像。这工作正常,但我在地图上得到一个奇怪的神器,我在使用标准标记图像时没有得到。

def map
    @json = School.where(:disabled => [false, nil]).to_gmaps4rails do |school, marker|
      marker.infowindow render_to_string(:partial => "schools/marker", :locals => { :object => school })
      if school.school_type_id == 1
        marker.picture({ "picture" => view_context.image_path('map_icons/blue_P.png'),"width" =>  '20',"height" => '34'})
      elsif school.school_type_id == 2
        marker.picture({ "picture" => view_context.image_path('map_icons/red_C.png'),"width" =>  '20',"height" => '34'})
      elsif school.school_type_id == 3
        marker.picture({ "picture" => view_context.image_path('map_icons/yellow_J.png'),"width" =>  '20',"height" => '34'})
      elsif school.school_type_id == 4
        marker.picture({ "picture" => view_context.image_path('map_icons/green_I.png'),"width" =>  '20',"height" => '34'})
      end

      marker.json({ :id => school.id })
    end

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @schools }
    end
  end

神器的图像:

http://foa-approved.org/map_artifact1.png

http://foa-approved.org/map_artifact2.png

我正在使用地图控件的css修复:

.map_container img {
    max-width: none;
}

此修复程序可以在标记图像上运行吗?还是完全不同的其他内容?

0 个答案:

没有答案