From 90b3b48e4b51b80387f5afb65553ca1868482f46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Bol=C3=ADvar?= Date: Tue, 6 Feb 2024 17:27:34 +0100 Subject: [PATCH] Fix maps --- config/initializers/decidim.rb | 71 +++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 6 deletions(-) diff --git a/config/initializers/decidim.rb b/config/initializers/decidim.rb index e46c732..d1e464e 100644 --- a/config/initializers/decidim.rb +++ b/config/initializers/decidim.rb @@ -9,13 +9,72 @@ config.default_locale = Rails.application.secrets.decidim[:default_locale].presence || :en config.available_locales = Rails.application.secrets.decidim[:available_locales].presence || [:en] - # Geocoder configuration - config.maps = { - provider: :here, - api_key: Rails.application.secrets.maps[:api_key], - static: { url: "https://image.maps.ls.hereapi.com/mia/1.6/mapview" } - } + # Map and Geocoder configuration + # + # == HERE Maps == + # config.maps = { + # provider: :here, + # api_key: Rails.application.secrets.maps[:api_key], + # static: { url: "https://image.maps.ls.hereapi.com/mia/1.6/mapview" } + # } + # + # == OpenStreetMap (OSM) services == + # To use the OSM map service providers, you will need a service provider for + # the following map servers or host all of them yourself: + # - A tile server for the dynamic maps + # (https://wiki.openstreetmap.org/wiki/Tile_servers) + # - A Nominatim geocoding server for the geocoding functionality + # (https://wiki.openstreetmap.org/wiki/Nominatim) + # - A static map server for static map images + # (https://github.com/jperelli/osm-static-maps) + # + # When used, please read carefully the terms of service for your service + # provider. + # + # config.maps = { + # provider: :osm, + # api_key: Rails.application.secrets.maps[:api_key], + # dynamic: { + # tile_layer: { + # url: "https://tiles.example.org/{z}/{x}/{y}.png?key={apiKey}&{foo}", + # api_key: true, + # foo: "bar=baz", + # attribution: %( + # © OpenStreetMap contributors + # ).strip + # # Translatable attribution: + # # attribution: -> { I18n.t("tile_layer_attribution") } + # } + # }, + # static: { url: "https://staticmap.example.org/" }, + # geocoding: { host: "nominatim.example.org", use_https: true } + # } + # + # == Combination (OpenStreetMap default + HERE Maps dynamic map tiles) == + # config.maps = { + # provider: :osm, + # api_key: Rails.application.secrets.maps[:api_key], + # dynamic: { + # provider: :here, + # api_key: Rails.application.secrets.maps[:here_api_key] + # }, + # static: { url: "https://staticmap.example.org/" }, + # geocoding: { host: "nominatim.example.org", use_https: true } + # } + # Geocoder configurations if you want to customize the default geocoding + # settings. The maps configuration will manage which geocoding service to use, + # so that does not need any additional configuration here. Use this only for + # the global geocoder preferences. + # config.geocoder = { + # # geocoding service request timeout, in seconds (default 3): + # timeout: 5, + # # set default units to kilometers: + # units: :km, + # # caching (see https://github.com/alexreisner/geocoder#caching for details): + # cache: Redis.new, + # cache_prefix: "..." + # } if Rails.application.secrets.maps.present? && Rails.application.secrets.maps[:static_provider].present? static_provider = Rails.application.secrets.maps[:static_provider] dynamic_provider = Rails.application.secrets.maps[:dynamic_provider]