Terrastories/terrastories

[Map] Use MapLibre for offline environment

rudokemper opened this issue · 0 comments

Just scoping out some eventual work to use MapLibre for the offline environment / profile.

I created a Ruby gem maplibre-gl-rails and tested it with Terrastories to make sure that it works, across all areas of the app. (Currently, the map library is piped from Rails to React to serve the map on the front end, as well as the different map views in the Rails CMS.)

To use maplibre-gl-rails instead of mapbox-gl-rails for offline maps, we will have to do the following. This is assuming implementation prior to any Rails / React refactor work in the future.

  • Add maplibre-gl-rails to the Rails Gemfile.
    • Can we selectively include either mapbox-gl-rails or maplibre-gl-rails in the Gemfile depending on Docker profile? A nice-to-have to keep filesize down.
  • In Map.jsx: if offline environment is detected, then use MapLibre functions instead of Mapbox functions. Maybe using useLocalMapServer or a smarter way per the Rails environment.
  • Implement a similar change across the Rails CMS, specifically in the show dashboards for Places and Stories, and the edit dashboard for Themes.
  • Import maplibre-gl instead of mapbox-gl for all of the SCSS assets.
  • Deactivate mapProjection (since that has not been implemented for MapLibre yet).