class Decidim::Map::Provider::StaticMap::Osm

The static map utility class for the OpenStreetMap based map services

Public Instance Methods

url_params(latitude:, longitude:, options: {}) click to toggle source

@See Decidim::Map::StaticMap#url_params

# File 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