Module: Liquid::Rails::GoogleStaticMapUrlFilter
- Defined in:
- lib/liquid4-rails/filters/google_static_map_url_filter.rb
Instance Method Summary collapse
-
#google_static_map_url(size, options = {}) ⇒ Object
size: ‘600x300’.
Instance Method Details
#google_static_map_url(size, options = {}) ⇒ Object
size: ‘600x300’
Available keys inside options center: ‘40.714728,-73.998672’ zoom: 13 maptype: ‘roadmap’, ‘satellite’, ‘terrain’, or ‘hybrid’ markers: an array of this ‘color:blue|label:S|40.702147,-74.015794’
or string with semicolon
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/liquid4-rails/filters/google_static_map_url_filter.rb', line 13 def google_static_map_url(size, ={}) markers = .delete('markers') markers = if markers markers = markers.split(';') if markers.is_a?(String) markers.map { |marker| { markers: marker }.to_query } else '' end = .merge('size' => size) querystring = [.to_query, markers].delete_if { |value| value.blank? }.join('&') "https://maps.googleapis.com/maps/api/staticmap?#{querystring}" end |