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
Requiring OSM attribution at runtime #9228
Comments
Actually, providing a default OSM attribution when none is provided and |
@mourner Given the sheer amount of Leaflet users that (a) are newbies and (b) use OSM tiles, this seems like a nice idea indeed. The cost in terms of codebase size is negligible IMO. (There is an alternative, which I can call "The OpenLayers Way": provide a Disclaimer: I have been in the OSMF (loooong ago), so I'm understandably biased in favour of OSM. |
likely the same for a.tile.openstreetmap.org / b.tile.openstreetmap.org / c.tile.openstreetmap.org deprecated addressing ( openstreetmap/operations#737 ) Disclaimer: I am really active in OSM community |
I think we could parse the URL of the tile-server in general and match it against a couple of known domains: const url = new URL('https://tile.openstreetmap.org/{z}/{x}/{y}.png');
const osmHosts = ['tile.openstreetmap.org', 'tile.osm.org'];
const isOsmUrl = osmHosts.some((host) => url.hostname.endsWith(host)); |
I think adding the attribution automatically can be our part to the OSM Community.
Let us add it in
Instead of creating a URL object, we could just check if the url-string contains the hosts. Maybe we should create a performance test. If the URL is faster or only slightly slower, let us use the URL object because it is cleaner. I would suggest to label it as
accepted
and
good first issue
|
It's a one-off check (when a I say |
I understand the importance of attribution, but I think adding attribution in the leaflet attribution control is not required. It can also be attributed in another part of the page right? Would a Leaflet user be able to do that if this change is added? |
|
Sure, the official OSMF attribution guidelines make it clear that, by the time the user sees the map, she must have already been exposed to the attribution, as we can infer from this:
|
Motivation
The Quick Start is explicit that the OpenStreetMap attribution is mandatory. In the common case that OSM's official tile server is used, the lib can check at runtime to provide an attribution, to benefit the developer and OSM.
Suggested solution
What about providing a default attribution, or giving an error, if the domain is any of
tile.openstreetmap.org
ortile.osm.org
and the attribution is absent?Additional context
I am an OSM contributor and hear cases of missing attribution with the OSM official tile server every now and then; so many that a repo was recently set up to keep track of them, and this includes cases where Leaflet is used.
The text was updated successfully, but these errors were encountered: