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

GFW 4.0: MapboxGL + Vector Plantations Layer #3702

Merged
merged 83 commits into from
Mar 11, 2019
Merged

Conversation

edbrett
Copy link
Contributor

@edbrett edbrett commented Feb 8, 2019

It's time for another upgrade! For the previous 3.0 release we rebuilt the whole map stack, built and open source layer manager, moved all the layers and data to the API, and built a significant amount of new code and features. All of this on top of the leaflet stack we had been developing along side Resource Watch. Now it's time to take it one step further and upgrade the entire map, API layers, and layer manager to Mapbox and vector layers. The original motivation for this change was to allow the displaying of the new Global Plantations layer which contains over 2.5 million geoms and metadata, making it too large to be handled by a GeoJSON layer in leaflet (or even a vector layer on leaflet), and still function within the map alongside the other layers. The solution is this PR!

The core upgrades we have made are:

  • Add MapboxGL with ReactMapboxGL from Uber. 🚕 🗺 💯
  • Created a new Layer Manager plugin for handling consistent Mapbox layer functionality (adding, removing, z-indexing, decoding etc).
  • Use deck.gl to create a new custom layer for tiling raster layers, converting them into bitmap images and decoding them into RGBA pixels for animation. Huge thanks to @mbarrenechea for his support and lead on this feature. 🙌 🔥 🗺 .
  • Migrated all API layers to provide vectorLayers style. Thanks to @01painadam and @benlaken for their mastery of the API.
  • New Popup and interaction workflow using Mapboxs' queryFeatures API.
  • Basemaps and labels are now loaded as a single set of layers and painted dynamically based on the map settings, making it both faster and more flexible.
  • Changed to mapbox draw from leaflet draw.

Key breaking changes in GFW:

  • Due to the 3D feature of MapboxGL we can no longer handle bounding boxes and fit to bounds in the same way. We have to handle all transitions of the view using viewport-web-mercator.
  • Zoom levels in Mapbox don't correlate to the same as Leaflet due to the blending of zoom levels. Now the min zoom is 2 and max zoom 19.
  • Mapbox and not Leaflet 😁.

Many many thanks to all involved in this feature. Some particular favourites: @mbarrenechea @01painadam @davidsingal @andresgnlez @blayhem @benlaken @faustoperez @danielcasius @Jamie-Gibson @sorodrigo

Copy link
Contributor

@dfrico dfrico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot to cover, but overall looks good and works fine on local. Good job 👍

data.map(d => {
const bboxCoords = d.bbox.slice(0, 4);
const bboxFromCoords = bbox(lineString(bboxCoords));
const reverseBbox = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you reverse the bounding box?

@edbrett edbrett changed the title Feature/mapbox gl Feature/mapbox gl (GFW 4.0) Mar 11, 2019
@edbrett edbrett changed the title Feature/mapbox gl (GFW 4.0) GFW 4.0: MapboxGL + Vector Plantations Layer Mar 11, 2019
@edbrett edbrett added develop Any PR that is ready to be merged to develop and removed WIP Any PR that should not be merged to develop labels Mar 11, 2019
@edbrett edbrett merged commit 0d8fa18 into develop Mar 11, 2019
@edbrett edbrett deleted the feature/mapbox-gl branch March 11, 2019 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
develop Any PR that is ready to be merged to develop staging Any PR expected to be kept on staging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants