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

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

Overview

The static map utility class for the OpenStreetMap based map services

Constant Summary

Constants inherited from StaticMap

StaticMap::DEFAULT_SIZE, StaticMap::DEFAULT_ZOOM

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 '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] || Decidim::Map::StaticMap::DEFAULT_ZOOM,
    width: options[:width] || Decidim::Map::StaticMap::DEFAULT_SIZE,
    height: options[:height] || Decidim::Map::StaticMap::DEFAULT_SIZE
  }
end