stamen / maperture

https://stamen.github.io/maperture/
MIT License
39 stars 12 forks source link

Should we use Mapbox GL v2 #174

Closed aparlato closed 1 year ago

aparlato commented 1 year ago

Right now in Maperture we use mapbox-gl < 2.0.0. This is the last version before it makes a significant change regarding billing on map views.

Based on https://docs.mapbox.com/mapbox-gl-js/guides/pricing/ , the main difference is billing will occur on map load whether or not you use Mapbox hosted tiles (previously you had to use Mapbox hosted tiles).

That said, the free tier is still very large (0 - 50k map views/month).

Options

1) Do nothing, stay < 2.0.0

Users who don't use Mapbox tiles will never see billing regardless of usage, but they won't have access to the latest features in GL JS.

2) Just upgrade to the latest mapbox-gl version

Maperture's intended use case would pretty much never go over the free tier, but that said, we can't know for sure how things are used.

Personally I think the user risk here is extremely low (and it's their own token they can revoke if need be) and we can track usage on our public version of the tool to avoid hitting that traffic limit.

3) Seek a way to let users choose which version of mapbox-gl they want to use from the config

If we do this, users can better replicate what they would see in their actual application and decide if they want to remain below 2.0.0. For example, we have had clients that remain below 2.0.0 for various reasons in their application, but maps are being designed and viewed in Maperture (which may mislead designers about what is supported irl).

4) Upgrade to latest mapbox-gl version and expose information about style support from the style spec

The implications billing-wise are the same as 2, but additionally, in this case, we would always render the map because we'd be running the latest version, but a user could select an old version of the SDK to check styles by and get warnings if appropriate (Mapbox Studio does this).

cc @ebrelsford

ebrelsford commented 1 year ago

I think I'd lean toward 2/3 and I'd be interested in seeing how hard it would be to add the option (Mapbox GL JS v1 and Mapbox GL JS v2 to the renderers dropdown:

image

Could be helpful in some situations but maybe not worth the effort.

aparlato commented 1 year ago

Makes sense! Maybe let's do 2 now then we follow up with 3 or 4?

4 is a lift, but to me that would be the most ideal behavior. That said, I could see confusion that we do something special like that for Mapbox and no other renderer.

I'd be interested in seeing how hard it would be to add the option (Mapbox GL JS v1 and Mapbox GL JS v2 to the renderers dropdown

Yea, 3 is hard if a user can choose any version, but if we just want to offer the latest 1.x.x and latest 2.x.x we should be able to install both packages with aliases and handle the same way we do Maplibre vs Mapbox renderers in the code. I'm fine with that as a lower cost option!

ebrelsford commented 1 year ago

Agreed. @aparlato if you have a chance would you mind doing the simple upgrade and deploy it, then we can open an issue for making which version you use an option?