Automated attribution in Maplibre GL JS

Hey all,

at Gramps Web, we’re about to switch from Leaflet to Maplibre GL JS. I noticed that the base map we use (OpenFreeMap) automatically sets the attribution text/links by specifying it in their style, while for OHM, I get the default attribution (which is only a link to Maplibre). I’ve seen in the docs that it’s recommended to set a custom attribution at map instantiation, but this doesn’t really work for us as we use multiple styles and the first time the user switches the style, the custom attribution is overwritten (plus, OHM is not the default style). I tried setting it manually on style change, but didn’t really manage so far (due to my limited abilities…).

Long story short, would it be possible to include the attribution key somewhere in the appropriate JSON file to make Maplibre pick it up automatically?

Thanks!
David

Hi David - great to hear from you and Gramps!

You’re ahead of us with MapLibre, but we hope to catch up shortly.

I hate to be “that guy,” but would you mind filing this request here? It’s more fun for the devs to have requests from the user base than from Minh or myself.

Separate from fixing our our attribution are there other ways we could better meet your needs as an OHM data consumer?

Thanks!
Jeff

1 Like