Skip to content

digitaltom/mapforge

Repository files navigation

Tests Docker Code Climate Coverage Status

README

Geojson

This app supports and stores data in an extended version of the geojson mapbox simplestyle spec. See docs/geojson.md for supported attributes.

Development Setup

Install dependencies:

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

Run develoment server:

bin/thrust rails server

  • Put map provider keys (MAPTILER_KEY, MAPBOX_KEY) into .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" }
  • Login for /admin is read from ENV.fetch("ADMIN_USER") and ENV.fetch("ADMIN_PW")
  • To import the initial frontpage, run: bin/rake seed:frontpage

Base maps

Available base maps are defined in app/javascript/map/layers/background_maps.js. There are also examples for using maptiler vector maps with custom styles, for example created with maputnik.

Rake tasks

  • Create map from a mapforge export:

    bin/rake seed:mapforge_file['db/seeds/examples/fosdem.json']

  • Create 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>]

Tests

Linters:

  • bin/rubocop
  • npm install; npm run lint:css; npm run lint:js

Fix style with eslint: npm run fix:js

Specs: bundle exec rspec

Container build

  • Build: sudo podman build -t mapforge --network=host .
  • Run: podman run -e SECRET_KEY_BASE=e3c9f2... mapforge

Github builds a new container on each commit to main: ghcr.io/digitaltom/mapforge