Mapbox GL JS v2.2.0: GeoJSON performance improvements and level roofs on 3D terrain

No items found.

Apr 8, 2021

Mapbox GL JS v2.2.0: GeoJSON performance improvements and level roofs on 3D terrain

Guest

No items found.

Guest

Apr 8, 2021

We’ve released Mapbox GL JS v2.2.0 with improved GeoJSON update performance in Safari, level roofs on 3D terrain for all fill extrusions, and a new Continuous Integration (CI) test mode so developers can include Mapbox in their automated testing suite and ensure a high quality experience for their customers.

Improved data update performance

Updating GeoJSON sources with setData(geojson) is now much faster in Safari, resulting in smoother data rendering for layers with frequently-updated data like vehicle or asset positions. Instacart leverages Mapbox GL to help users track their order in real-time and this update means their users will experience smooth animations as their order approaches their front door, regardless of browser.

Before / After

Level roofs on 3D terrain

Roofs on 3D buildings are now level relative to the earth rather than the terrain. Level roofs are now drawn for all fill-extrusion layers drawn on top of terrain. Previously, the top face of extruded features on layers using custom data followed the elevation of terrain. Extrusions are now drawn correctly with a level top for all custom data layers.

Before / After

Continuous Integration (CI) Test Mode

Test mode lets developers include GL JS in automated tests without an access token. Developers can ensure complete test coverage and rapidly iterate on code with confidence they are delivering high quality applications to their customers. Maps created in test mode don’t load resources from Mapbox and do not trigger billing. The GL JS API still works as expected and your tests can load test styles and tiles locally. In test mode you can still:

  • Listen for interaction events such as click and mouseover on Layers.
  • Interact with Markers and Popups
  • Query features data with map.queryRenderedFeatures()
  • Update the camera center, zoom or bearing and use map.easeTo() and map.flyTo()

Upgrading to v2.2.0

Mapbox GL JS v2.2.0 is available on CDN. Include the JavaScript and CSS files in the <head> block of your HTML file to upgrade:


<script src='https://api.mapbox.com/mapbox-gl-js/v2.2.0/mapbox-gl.js'></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v2.2.0/mapbox-gl.css' rel='stylesheet'/>

See the v2.2.0 release notes for a full list of changes.

No items found.
No items found.

Maps feature data from Mapbox © Mapbox, OpenStreetMap © OpenStreetMap and their data partners, including Maxar (if applicable, © Maxar).

Related articles