Add a new map interactive in your homepage content blocks. This module display the assemblies linked to a Participatory Process on a map, based on given GeoJSON.
To configure a working interactive map in your Decidim application, you must define before :
MAPS_API_KEY
env var- Uncomment the maps section in decidim initializer
development_app/config/initializers/decidim.rb:38
- Define :
- Assemblies with scope
- Scope with GeoJSON content
- PP with linked assemblies enabled (geocoding address for PP is not required)
Seeds should create expected resources see seeds file
Add this line to your application's Gemfile:
gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git"
And then execute:
bundle
bundle exec rake decidim_homepage_interactive_map:install:migrations
bundle exec rake db:migrate
bundle exec rake decidim_homepage_interactive_map:webpacker:install
- On OSX:
brew install proj
bundle config set build.rgeo-proj4 --with-proj-dir="/opt/homebrew/"
bundle pristine rgeo-proj4
bundle install
- On Ubuntu:
sudo apt update && sudo apt install libproj-dev proj-bin -y
bundle config set build.rgeo-proj4 --with-proj-dir="/usr/local/bin/"
bundle pristine rgeo-proj4
bundle install
bundle exec rake decidim_homepage_interactive_map:repair_data
No need to do anything, the module will automatically transpose the scope position.
In Decidim's backoffice, enable Interactive map content block.
- The content block will first ensure map api key is defined.
- Ensure linked assemblies are present
- Load a leaflet map inside the content block
- Fetch assemblies and scopes
- Apply GeoJSON as zone layer
- Define markers for each assemblies
- Load participatory process
- If PP has location, places the marker at the defined address
- Otherwise, place the participatory process on the top right corner of assemblie marker (like a notification badge)
See Decidim.
This engine is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.