Google Maps allows you to create custom icons for your markers. Google4R::Maps allows you to create icons from your Ruby code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
map = Google4R::Maps::GMap2.new("map", "map-div") point = [ 37.4419, -122.1419 ] # Create a custom icon. arrow = map.create_icon(true) # copy of G_DEFAULT_ICON arrow.icon_size = [ 39, 34 ] arrow.image = 'http://maps.google.com/mapfiles/arrow.png' arrow.print_image = 'http://maps.google.com/mapfiles/arrow.png' arrow.shadow = 'http://maps.google.com/mapfiles/arrowshadow.png' arrow.print_shadow = 'http://maps.google.com/mapfiles/arrowshadow.png' arrow.moz_print_image = 'http://maps.google.com/mapfiles/arrowff.gif' arrow.transparent = 'http://maps.google.com/mapfiles/arrowtransparent.png' # A marker with the default marker icon. marker = map.create_marker([ point[0] - 0.5, point[1] ]) # A marker with the icon we just created. marker = map.create_marker([ point[0] + 0.5, point[1] ]) marker.icon = arrow # Another marker with the icon we just created. marker = map.create_marker([ point[0], point[1] ]) marker.icon = map.icons.last map.to_html |