diff --git a/README b/README index 15f424e..6bbb047 100644 --- a/README +++ b/README @@ -391,7 +391,13 @@ You can pass options to the control_init as well. They are: So if you wanted the local search control to be at the bottom right of the map, 30 pixel in from the right and 20 pixels above the bottom and some local search options it would look like this: @map.control_init(:large_map => true, :map_type => true, :local_search => true, :anchor => :bottom_right, :offset_width => 30, :offset_height => 20, :local_search_options => "{suppressZoomToBounds : true, resultList : google.maps.LocalSearch.RESULT_LIST_INLINE, suppressInitialResultSelection : true, searchFormHint : 'Local Search powered by Google', linkTarget : GSearch.LINK_TARGET_BLANK}") +==Sensor +Google now requires the 'sensor' attribute in the GET API request. It is defaulted to 'false', but if you are writing an application for one of the new cellphones with GPS out there then you can enable it by using the following call: + +<%= GMap.header :sensor => true %> + ==Recent changes +- 'sensor' added to GET URL per Google API Terms of Use. 'false' by default. - Local Search overlay added. See above for implementation. - GMarker can now be placed by address (in addition to coordinates). Some code to geocode the address when the marker is initialized is added - Addition of a +center_zoom_on_points_init+ to center and zoom on a group of pixel diff --git a/lib/gm_plugin/geocoding.rb b/lib/gm_plugin/geocoding.rb index ea015eb..113981e 100644 --- a/lib/gm_plugin/geocoding.rb +++ b/lib/gm_plugin/geocoding.rb @@ -16,8 +16,9 @@ module Geocoding #Gets placemarks by querying the Google Maps Geocoding service with the +request+ string. Options can either an explicity GMaps API key (:key) or a host, (:host). def self.get(request,options = {}) api_key = ApiKey.get(options) + sensor = options[:sensor] || false output = options[:output] || "kml" - url = "http://maps.google.com/maps/geo?q=#{URI.encode(request)}&key=#{api_key}&output=#{output}" + url = "http://maps.google.com/maps/geo?q=#{URI.encode(request)}&key=#{api_key}&sensor=#{sensor}&output=#{output}" res = open(url).read diff --git a/lib/gm_plugin/map.rb b/lib/gm_plugin/map.rb index e0a5b24..17f69ae 100644 --- a/lib/gm_plugin/map.rb +++ b/lib/gm_plugin/map.rb @@ -30,8 +30,9 @@ def self.header(options = {}) options[:with_vml] = true unless options.has_key?(:with_vml) options[:hl] ||= '' options[:local_search] = false unless options.has_key?(:local_search) + options[:sensor] = false unless options.has_key?(:sensor) api_key = ApiKey.get(options) - a = "\n" + a = "\n" a << "\n" unless options[:without_js] a << "" if options[:with_vml] a << "" if options[:local_search]