Class: Decidim::Map::Provider::StaticMap::Osm

Inherits:
StaticMap show all
Defined in:
decidim-core/lib/decidim/map/provider/static_map/osm.rb

Overview

The static map utility class for the OpenStreetMap based map services

Instance Attribute Summary

Attributes inherited from Utility

#configuration, #locale, #organization

Instance Method Summary collapse

Methods inherited from StaticMap

#image_data, #link, #url

Methods inherited from Utility

#initialize

Constructor Details

This class inherits a constructor from Decidim::Map::Utility

Instance Method Details

#url_params(latitude:, longitude:, options: {}) ⇒ Object


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'decidim-core/lib/decidim/map/provider/static_map/osm.rb', line 10

def url_params(latitude:, longitude:, options: {})
  # This is the format used by osm-static-maps which is not an
  # official OSM product but it should be rather easy to setup. For
  # further information, see:
  # https://github.com/jperelli/osm-static-maps
  {
    geojson: {
      type: "Point",
      coordinates: [longitude, latitude]
    }.to_json,
    zoom: options[:zoom] || 15,
    width: options[:width] || 120,
    height: options[:height] || 120
  }
end