Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Update to use Maplibre with Protomaps API #988

Merged
merged 18 commits into from
Jan 15, 2024

Conversation

lauramosher
Copy link
Contributor

This PR is backwards compatible with usage of mapbox configuration and maplibre with Tileserver.

It further expands functionality to:

  • Allow usage of Maplibre across both front end and backend
  • Updates Minimap to work with Maplibre
  • Adds configuration to allow the usage of protomaps tiles, base maps, and assets; including generation of Style Specification when an api.protomaps.com style is provided
  • Ensures Tileserver is configured to serve all fonts so we can utilize fallbacks when a font is not found.

Testing

  • Create a free API key at protomaps.com or ask a Terrastories steward for one
  • If you already have .env file, ensure that it does not contain any of the MAPBOX_* ENV vars set (comment them out)
  • Set PROTOMAPS_API_KEY to the newly created API key, or the one you received from a steward
  • Pull down this PR

Development

run docker compose --profile dev up

If you run into issues with dependencies, run:

docker compose run --rm web yarn
docker compose run --rm web bundle

Offline

This assumes you already have the database setup.
This assumes you already have tileserver setup.

If you have neither, run bin/setup before proceeding.

  1. Update compose.yaml service localweb image tag to alpha-0.0.1 which contains a prebuilt image from these changes, OR run docker build -t terrastories-offline-test -f rails/Dockerfile . and then update the image to
    image:  terrastories-offline-test 
    
  2. Run docker compose --profile offline up

Copy link
Member

@rudokemper rudokemper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so, so awesome!

A few comments:

  • Now that we are using Protomaps for online, the title "Online Map Configuration" in Theme makes less sense. Can we make a change in this PR to call it "Mapbox Map Configuration (Optional)"? And rename "Activate 3D Terrain view for online map" to "Activate 3D Terrain view for Mapbox map"?
  • The Rails Place show map zooming behavior is a bit wonky for me in both Mapbox and Maplibre. Sometimes it will work at first, and then stop; other times I can only zoom in/out a little bit. I think it might have to do with panning being disabled. I'd say we can just enable it. I don't think it's undesirable to permit the user to pan around; if they get lost, they can just refresh the page.
  • I know we are planning docs overhaul, but I think it could be good to at least have some bare minimum indication of how to set things up, like the Protomaps API key env var. I'm happy to contribute this - will push up a change.

@lauramosher lauramosher merged commit 5abcfb6 into master Jan 15, 2024
@lauramosher lauramosher deleted the feat/default-to-protomaps-api branch January 15, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants