Mapforge is an open source (Ruby on Rails) web application that lets you create and share geojson layers on top of different base maps. It uses maplibre gl as map library and supports desktop and mobile views. Your browser is connected to the server via websockets, so all changes are immediately visible to all clients for collaborative editing or creating real-time maps.
A reference installation is running at mapforge.org, see the changelog here.
The geojson layer can get styled to your needs in an extended version of the geojson mapbox simplestyle spec. See docs/geojson.md for supported attributes.
For openSUSE (Debian package names in braces):
zypper in proj-devel # (libproj-dev) for building rgeo-proj4
zypper in proj # (proj-bin) for running rgeo-proj4
zypper in npm # for running eslint
bundle
bin/thrust rails server
- To use Maptiler base maps, provide the key (MAPTILER_KEY) in
.env.development
- MongoDB backend is expected at:
ENV.fetch("MONGO_URL") { "localhost:27017" }
- Redis (for action cable) is expected at:
ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" }
- To allow login via Github and Google, create oauth apps there, and set
GITHUB_CLIENT_ID
/GITHUB_CLIENT_SECRET
andGOOGLE_CLIENT_ID
/GOOGLE_CLIENT_SECRET
. - The first user that logs in automatically gets set as admin
- The default base map can get set with
DEFAULT_MAP
In development, the ENV vars can get set in the file .env.development
.
Available base maps are defined in app/javascript/maplibre/basemaps.js.
Some base maps are only available with a https://www.maptiler.com/cloud/ key, provided as ENV MAPTILER_KEY
.
There are also examples for using maptiler vector maps with custom styles, for example created with maputnik.
-
Import map from a mapforge export:
bin/rake seed:mapforge_file['db/seeds/examples/fosdem.json']
-
Import map from geojson (samples in db/seeds):
bin/rake seed:geojson_file['db/seeds/examples/germany_areas.json']
More geojson example files at: https://exploratory.io/map
-
Take screenshots of existing maps for preview:
bin/rake maps:screenshots[<changed_since_hours>]
(use MAPFORGE_HOST to set the host) -
Animate a marker along a line:
bin/rake animation:path[<map_id>, <line_id>, <point_id>]
Linters:
bin/rubocop
npm install; npm run lint:css; npm run lint:js
Fix style with eslint: npm run fix:js
To run the test suite: bundle exec rspec
The repository is also covered with automatic Github Actions jobs. You can
run those locally with the tool act.
For example act -j test
.
Github builds a new container on each commit to main
at: ghcr.io/digitaltom/mapforge:main
. Or, you can build your own image with: podman build -t mapforge .
.
Before running the container, make sure the services MongoDB (podman run -d --name mongo -v <local_dir>:/data/db -p 27017:27017 mongo:7.0
) and Redis (podman run -d --name redis -p 6379:6379 redis
) are running.
Now, you can run the image with: podman run -e SECRET_KEY_BASE=e3c9f2... ghcr.io/digitaltom/mapforge:main
(use -e RAILS_ENV=development
if you don't have an SSL termination, like Traefik in front of the container)