Class: Geogov::OpenStreetMap
- Inherits:
-
Object
- Object
- Geogov::OpenStreetMap
- Defined in:
- lib/geogov/providers/open_street_map.rb
Instance Method Summary collapse
-
#initialize(url = "http://ojw.dev.openstreetmap.org") ⇒ OpenStreetMap
constructor
A new instance of OpenStreetMap.
- #map_href(lat, long, options = {}) ⇒ Object
- #map_img(lat, long, options = {}) ⇒ Object
Constructor Details
#initialize(url = "http://ojw.dev.openstreetmap.org") ⇒ OpenStreetMap
Returns a new instance of OpenStreetMap.
5 6 7 |
# File 'lib/geogov/providers/open_street_map.rb', line 5 def initialize(url = "http://ojw.dev.openstreetmap.org") @url = url end |
Instance Method Details
#map_href(lat, long, options = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/geogov/providers/open_street_map.rb', line 30 def map_href(lat,long, = {}) = { :zoom => [:z] || 14, :lat => lat, :lon => long, :layers => "M" }.merge() if [:marker_lat] && [:marker_lon] [:mlat0] = .delete(:marker_lat) [:mlon0] = .delete(:marker_lon) end params = Geogov.hash_to_params() "http://www.openstreetmap.org/?#{params}" end |
#map_img(lat, long, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/geogov/providers/open_street_map.rb', line 9 def map_img(lat,long, = {}) = { :w => 200, :h => 200, :z => 14, :mode => "export", :lat => lat, :lon => long, :show => 1 }.merge() if [:marker_lat] && [:marker_lon] [:mlat0] = .delete(:marker_lat) [:mlon0] = .delete(:marker_lon) end params = Geogov.hash_to_params() "#{@url}/StaticMap?#{params}" end |