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

Use Geofield and Leaflet modules for maps, to respect user privacy #81

Open
gitressa opened this issue May 17, 2024 · 5 comments
Open

Comments

@gitressa
Copy link

gitressa commented May 17, 2024

To respect user privacy, usage of external resources should be kept at a minimum, or avoided entirely.

The Geolocation module contacts the external web site unpkg.com for the https://unpkg.com/leaflet@1.8.0/dist/leaflet.js file, when it shows the map on /event/2024/nasas-boeing-crew-flight-test-launch. The maintainer stated in Allow to choose between local or external libraries that:

I think it's pretty likely that some people want to host the libraries locally, but they can do so using hook_js_alter() as they deem fit. Providing all the plumbing to handle this in a form and keeping this up to date in the future seems to much effort for an each case that can be solved fairly easily anyway.

So we could instead use Geofield module with the Leaflet module.

Leaflet module does currently contact fastly.net, but as soon as Support serving local scripts first, use CDN as fallback is fixed, Geofield with Leaflet ought to only contact the relevant map resource, which is openstreetmap.org. I was mistaken, OpenStreetMap uses fastly.net to serve its tiles, so fastly.net is necessary, and all is well with the Leaflet module.

Remaining tasks

Switch from Geolocation to Geofield and Leaflet.

@phenaproxima
Copy link
Owner

phenaproxima commented May 21, 2024

I'm totally open to this idea; the goal at the time I used Geolocation was to just get a freakin' map working on the event page in time for DrupalCon 😅 I tried with Geofield but I could NOT, for the life of me, figure out how to configure it. In other words, I ran into exactly the kind of problem that Starshot aims to solve. 😎

If you (or someone else?) submits a PR which changes to Geofield and Leaflet, whilst keeping the zero-setup, oh-look-I-immediately-have-a-working-map experience of the Event content type, then I will gladly merge that.

@gitressa
Copy link
Author

Sounds fantastic, thanks for being open for this update! And yes, getting all the pieces to fit together for Geocoder, Geofield, et al can be challenging :)

I recently documented how to set up Geocoder to work with GPX-files based on a fantastic step-by-step guide by @FMB in Document GPX File Parsing Provider.

I would love to try to update the Starshot recipe, but I haven't worked with Recipes yet ... so I would probably have to spend some time understanding how it fits together. So instead of trying to create the new set up in a recipe, I decided to instead document how to set up Geocoder, Geofield and Address module in Using Address module with Geocoder and Geofield, perhaps you could give it a try?

After going through the steps in the documentation, to show the map in Starshot, you can add a "Map" block in Layout Builder. Click "Manage Layout" and then:

  • Click "Configure Section 3"
  • Add "Map", with these settings:
    • Formatter: Leaflet
    • Zoom: 16

Please let me know if any of the steps does not make sense, so I can update the documentation, thanks!

@gitressa
Copy link
Author

gitressa commented May 23, 2024

OpenStreetMap, and the sites it contacts are located in these countries outside EU, which conflicts with GDPR compliance:

  • openstreetmap.org: Canada/United States
  • fastly.net: Canada/United States
  • unpkg.com: Canada/United States

https://maps.wikimedia.org could be considered as an alternative map tile source, since it is located in the Netherlands when I checked with https://check-host.net/ip-info?host=maps.wikimedia.org.

We can use the https://git.drupalcode.org/project/leaflet_more_maps/ module to support this map provider. Sadly, it does not work any more ... see Remove Wikimedia Maps.

Still, switching to Geocoder, Geofield and Address will remove the need to contact unpkg.com for the leaflet.js file.

@gitressa
Copy link
Author

gitressa commented May 24, 2024

I checked https://wiki.openstreetmap.org/wiki/Raster_tile_providers and found an alternative tile provider https://openstreetmap.de/, which only contacts a single domain for map tiles, which is openstreetmap.de hosted at Hetzner in Germany.

I created the issue Add support for GDPR-friendly openstreetmap.de. Feel free to review, so that we perhaps can use that as map service for tiles in Starshot, with https://www.drupal.org/project/leaflet_more_maps?

@gitressa
Copy link
Author

gitressa commented May 30, 2024

Good news, everyone! Leaflet More Maps 2.2 was just released, and it includes many improvements, among them the option of using openstreetmap.de for Leaflet tiles, completed via Add support for GDPR-friendly openstreetmap.de.

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

No branches or pull requests

2 participants