Leaflet / Leaflet

🍃 JavaScript library for mobile-friendly interactive maps 🇺🇦
https://leafletjs.com
BSD 2-Clause "Simplified" License
40.28k stars 5.76k forks source link

"Leaflet Quick Start Guide" should offer a simpler Tile Provider #6336

Closed brunob closed 2 years ago

brunob commented 5 years ago

Hi, i've just read someone saying that quick start doesn't work since it use MB tiles with no accessToken defined. See also #6280 & #6268 and as @IvanSanchez said :

apparently the mapbox tokens are confusing more people.

I propose to change the base tiles on this example, and maybe it would be better to apply this everywhere MapBox tiles are used in examples pages. Any thought about it ?

Shizen commented 5 years ago

Serendipitously I happened to be looking at your Quickstart documentation right at this moment, and been having trouble getting it to do anything at all. I am working in JSFiddle for convenience, which makes this easy to share. The code doesn't seem to make it past the L.map('mapid') call, really.

JSFiddle of Quickstart

I've tried a few different places to work around the access token requirements, since I was just looking to see how hard it was to get leaflet up and running. Your example also sets options for id and accessToken passed into the L.tileLayer() call, which are not listed in the API docs for tileLayer. (maxZoom and attribution are though).

brunob commented 5 years ago

PR proposed, i see that others examples using MB tiles could also use other tilesets : mobile, geojson, layers-control, choropleth. Video-overlay can stick on MB tiles i think. Any thought about it ? Should i push in the same PR or in a separate one for each example ?

brunob commented 5 years ago

One month later, any news about this or should i close #6337 ?

ghybs commented 5 years ago

Hi @brunob,

We appreciate your contributions, both the issue and the PR.

I think we all agree about the potential advantages of using OSM tiles in Leaflet code snippets: simplify code (no more id, accessToken undocumented keys…), less friction (works as-is, not directing to external service, not having to realize that one can change the tile source and having to look for such sources…), etc.

Now my personal view on this is that we face 2 difficulties in switching the Tile provider from Mapbox to OSM:

  1. OSM tiles should be used only for testing / small scale usage.
  2. Mapbox "implicitly sponsors" Leaflet.

1. OSM tiles should be used only for testing / small scale usage.

As pointed out by @perliedman:

[…] as long as it's for testing / small scale usage (see Tile Usage Policy).

And in switch2osm:

Apart from very limited testing purposes, you should not use the tiles supplied by OpenStreetMap.org itself.

Unfortunately, we all know we are lazy and no longer care once we have a working technical solution: people forget any associated administrative / legal restriction when upscaling / deploying.

The mere fact that your PR also uses OSM tiles in live examples illustrates this situation: you may not realize the high traffic on Leaflet pages, which could be considered a "heavy use".

Furthermore:

Do not hardcode any URL at tile.openstreetmap.org into an app

…so even providing OSM tiles URL in Leaflet website code snippets could be interpreted as a violation.

2. Mapbox "implicitly sponsors" Leaflet.

While not explicitly written, Leaflet main author is employed by Mapbox. Somehow they "agree" that he spends some of his energy (whether at work or free time) on this Open Source project.

Besides, Mapbox provides an access token for Leaflet website live examples, so switching those to OSM is unnecessary (and could be considered a violation of OSM Tile Usage Policy, as already explained above).

ghybs commented 5 years ago

All that being said, I still understand that the current code snippets give more friction to newcomers than it should be.

@matkoniecz's proposal to use CartoDB basemaps instead sounds a reasonable approach to simplify code (no need for id and accessToken) while still providing a compliant solution.

brunob commented 5 years ago

Thx for the answer @ghybs

1 / concerning the tiles usage policy i don't think leaflet webiste is a commercial use

OpenStreetMap is a volunteer-run non-profit body and cannot supply tiles for large-scale commercial use. ... and the website is not an app. 2 / > Leaflet main author is employed by Mapbox I know that, i've talked with @mourner since the early's days of Leaflet on github :)

So, if we are talking about a sponsorship problem here, i understand why you prefer to stick on mapbox tiles. If you are still open to change the tiles source and to simplify examples files for users (which imo are the main persons concerned by this examples pages) i can provide another PR to use cartodb are any other tile provider.

For the record, i was proposing osm tiles because it's not a commercial provider, in order to stay neutral on example page and also to promote OSM project (which use Leaflet on its home page).

brunob commented 5 years ago

@ghybs just for the "fun" about the high traffic on Leaflet page, you may have seen that https://leafletjs.com/ home page use tile.openstreetmap.org tiles ;)

matkoniecz commented 5 years ago

PR "Fix #6336 : use openstreetmap tiles in quickstart guide: (#6337) was rejected.

I am not sure why @ghybs kept this issue open.

ghybs commented 5 years ago

https://leafletjs.com/ home page use tile.openstreetmap.org tiles ;)

Lol nice catch! :sweat_smile:

i was proposing osm tiles because it's not a commercial provider, in order to stay neutral […]

I think we all agree as well on this, but the issue is that…

to promote OSM project

…it is difficult to say we are helping OSM by increasing (directly and indirectly through recommendation) the load on their Tile Servers, whereas they explicitly request not to do so. By using Mapbox or CartoDB tiles, we are still crediting OSM.

matkoniecz commented 5 years ago

@ghybs Given that #6337 was rejected for reasons that are unfixable - maybe also close this issue as WONTFIX/DECLINED?

ghybs commented 5 years ago

Hi @matkoniecz,

Indeed that is the idea, but there is still the point of trying to provide an easier example in quick start tutorial.

Maybe provide several examples with a few providers (Mapbox and CartoDB?), in order to show that Leaflet is provider agnostic and have a simpler example (CartoDB), while still maintaining a reference to Mapbox?

I see that you have also created issue #6383 for the point of using another tile provider on Leaflet home page, thanks!

By curiosity, are you affiliated with OSM?

matkoniecz commented 5 years ago

By curiosity, are you affiliated with OSM?

I am active as a mapper, in discussions on mailing lists and in some projects like https://github.com/westnordost/StreetComplete or https://github.com/gravitystorm/openstreetmap-carto/ Even my site ( https://mapsaregreat.com/ ) is mostly about OSM.

So yes, by any reasonable definition.

brunob commented 5 years ago

'k should i take some time to propose another PR adapted to use cartodb tiles or should i just forget about it ?

brunob commented 5 years ago

FTR as said in https://github.com/CartoDB/basemap-styles

Limitations: free usage for up to 75,000 mapviews per month, none-commercial services only.

ghybs commented 5 years ago

Hi @perliedman,

Would the quick start stats fit within this limit?

ghybs commented 5 years ago

Hi @brunob,

should i take some time to propose another PR adapted to use cartodb tiles

Sure! What I could imagine for now would be a kind of tabbed examples, with Mapbox by default and CartoDB next. That way the default display still uses the Mapbox token for Leaflet, but the tutorial provides an alternative for a more simple scheme. What do you think?

brunob commented 5 years ago

@ghybs i think we should make it simple, showing mapbox by default will not prevent mistake like #6280

Falke-Design commented 2 years ago

Summary:

If @mourner decides we keep Mapbox then this issue can be closed.

brunob commented 2 years ago

Frankly, i'm a bit desperate that it took more than 4 years to take a decision on this simple problem :(

If "we" (is there still a we, as a real community, in Leaflet today ?) decide to use OSM tiles, we just have to ask OSM techs if that move is out or their TOS. I can contact some of thme, and some of them are/were already here ping @yohanboniface :)

If "we" want to swtich to another one, there is a bunch of providers available in https://github.com/leaflet-extras/leaflet-providers (as @Falke-Design was pointing in another issue), just pick one and you're done.

Anyway, i think we can gently ask to OSM if a friend project that they use on their home page can "in return" use their tiles on is quick start guide/docs/etc.

mourner commented 2 years ago

Good point, Bruno. If OSM is OK with this, it might be a good idea to use it consistently across docs and tutorials, provided we include a nicely worded warning in the quick start guide that it's only for demo purposes and we strongly advice using commercial providers in real apps (with links to recommendations).

Falke-Design commented 2 years ago

@brunob can you take care of this and get in contact with OSM? or do you want to do this @mourner? Anyway if OSM allows the use of the tiles please get @mourner involved.

yohanboniface commented 2 years ago

ping @tomhughes

tomhughes commented 2 years ago

What's the question? The policy is at https://operations.osmfoundation.org/policies/tiles/ if that's the question?

Falke-Design commented 2 years ago

We need permission to use OSM Tiles in Leaflet Docs / Tutorials

Heavy use (e.g. distributing an app that uses tiles from openstreetmap.org) is forbidden without prior permission from the Operations Working Group. See below for alternatives.

brunob commented 2 years ago

@tomhughes the question is : what OSM community, mostly techs, think about the fact that Leaflet would use OSM tiles in its examples files ? We don't want to overload OSM servers, but we prefer to promote OSM tiles in our examples instead of MapBox ones.

tomhughes commented 2 years ago

You need permission for heavy use - is this heavy use? Who knows because that term is completely undefined which is why everybody that asks OWG just gets a shrug in response. That part of the policy is just stupid but nobody knows what else to say.

brunob commented 2 years ago

So we may start our "not so heavy" use, and wait for a shrug if what we do is considered as an abuse ? :)

johnd0e commented 2 years ago

@mourner Should we reopen #6337?

simonpoole commented 2 years ago

So we may start our "not so heavy" use, and wait for a shrug if what we do is considered as an abuse ? :)

To avoid misunderstandings: reality is that there is no such thing as permission for heavy use, the application will simply be blocked if it is deemed to use too many resources. The "asking for permission" bit was probably intended so that users that were going to be blocked in any case could be informed of the errors of their ways in advance and be pointed to commercial services, as @tomhughes points out that just doesn't work in real life.

brunob commented 2 years ago

Another case of someone trapped by it on #7817 :\

johnd0e commented 2 years ago

Tile service is not free. Even OSM. Everyone should understand it.