class MapLocation

Container class for a location on the map. Set either a latitude and longitude, or an address

Attributes

address[RW]

String address - can be a full address, city name, zip code, etc. This is ignored if latitude and longitude are set.

latitude[RW]

Decimal degrees, positive is north

longitude[RW]

Decimal degrees, positive is east

Public Class Methods

new(attrs={}) click to toggle source
# File lib/googlestaticmap.rb, line 213
def initialize(attrs={})
  attrs.each {|k,v| self.send("#{k}=".to_sym,v.to_s)}
end

Public Instance Methods

to_s() click to toggle source
# File lib/googlestaticmap.rb, line 217
def to_s
  if latitude && longitude
    "#{CGI.escape(latitude.to_s)},#{CGI.escape(longitude.to_s)}"
  elsif address
    CGI.escape(address)
  else
    raise Exception.new("Need to set either latitude and longitude, or address")
  end
end