class MapMarker
A single marker to place on the map. Initialize and pass
Attributes
Manage position of marker (anchor:center/bottom/top..) See - developers.google.com/maps/documentation/maps-static/intro#Markers
A 24-bit color (example: 0xFFFFCC) or a predefined color from the set {black, brown, green, purple, yellow, blue, gray, orange, red, white}
a URL to use as the marker's custom icon. Images may be in PNG, JPEG or GIF formats, though PNG is recommended
(optional) A single uppercase alphanumeric character label from the set {A-Z, 0-9}. Not allowed for tiny and small sizes
MapLocation for the position of this marker
true (default) indicates that the Static Maps service should construct an appropriate shadow for the image. This shadow is based on the image's visible region and its opacity/transparency.
(optional) The size of marker from the set {tiny, small, mid}. Defaults to mid
Public Class Methods
Takes an optional hash of attributes
# File lib/googlestaticmap.rb, line 259 def initialize(attrs={}) attrs.each {|k,v| self.send("#{k}=".to_sym,v)} end
Public Instance Methods
# File lib/googlestaticmap.rb, line 263 def to_s raise Exception.new("Need a location for the marker") unless @location && @location.is_a?(MapLocation) attrs = GoogleStaticMapHelpers.safe_instance_variables(self, ["location"]) s = attrs.to_a.sort_by {|x| x[0]}.collect do |k| # If the icon URL is URL encoded, it won't work val = (k[0] == "icon" ? k[1] : CGI.escape(k[1].to_s)) "#{k[0]}:#{val}" end.join(MAP_SEPARATOR) s << MAP_SEPARATOR << @location.to_s end