module Geos::GoogleMaps::Api3::Geometry
Public Instance Methods
to_g_geocoder_bounds_api3(precision = 6)
click to toggle source
Returns a bounds parameter for the Google Maps API 3 geocoder service.
# File lib/geos/google_maps/api_3.rb, line 40 def to_g_geocoder_bounds_api3(precision = 6) "#{self.lower_left.to_g_url_value(precision)}|#{self.upper_right.to_g_url_value(precision)}" end
to_g_lat_lng_bounds_api3(options = {})
click to toggle source
Returns a new LatLngBounds object with the proper LatLngs in place for determining the geometry bounds.
# File lib/geos/google_maps/api_3.rb, line 35 def to_g_lat_lng_bounds_api3(options = {}) "new google.maps.LatLngBounds(#{self.lower_left.to_g_lat_lng_api3(options)}, #{self.upper_right.to_g_lat_lng_api3(options)})" end
to_g_lat_lng_bounds_string_api3(precision = 10)
click to toggle source
Returns a String in Google Maps' LatLngBounds#toString() format.
# File lib/geos/google_maps/api_3.rb, line 45 def to_g_lat_lng_bounds_string_api3(precision = 10) "((#{self.lower_left.to_g_url_value(precision)}), (#{self.upper_right.to_g_url_value(precision)}))" end
to_g_marker_api3(marker_options = {}, options = {})
click to toggle source
Returns a new Marker at the centroid of the geometry. The options Hash works the same as the Google Maps API MarkerOptions class does, but allows for underscored Ruby-like options which are then converted to the appropriate camel-cased Javascript options.
# File lib/geos/google_maps/api_3.rb, line 63 def to_g_marker_api3(marker_options = {}, options = {}) options = { :escape => [], :lat_lng_options => {} }.merge(options) opts = Geos::Helper.camelize_keys(marker_options) opts[:position] = self.centroid.to_g_lat_lng(options[:lat_lng_options]) json = Geos::Helper.escape_json(opts, Geos::GoogleMaps::Api3Constants::UNESCAPED_MARKER_OPTIONS - options[:escape]) "new google.maps.Marker(#{json})" end
to_g_polygon_api3(polygon_options = {}, options = {})
click to toggle source
Returns a new Polygon
.
# File lib/geos/google_maps/api_3.rb, line 55 def to_g_polygon_api3(polygon_options = {}, options = {}) self.coord_seq.to_g_polygon_api3(polygon_options, options) end
to_g_polyline_api3(polyline_options = {}, options = {})
click to toggle source
Returns a new Polyline.
# File lib/geos/google_maps/api_3.rb, line 50 def to_g_polyline_api3(polyline_options = {}, options = {}) self.coord_seq.to_g_polyline_api3(polyline_options, options) end