nitaliano / react-native-mapbox-gl

A Mapbox GL react native module for creating custom maps
Other
2.16k stars 697 forks source link

Fit to the bounds of a LineString #1560

Closed klase closed 5 years ago

klase commented 5 years ago

I'm trying to fit bounds to a LineString as in this example: https://docs.mapbox.com/mapbox-gl-js/example/zoomto-linestring/

How can I create a LngLatBounds instance that has the extend method with this library? I can't find it on the MapboxGL.MapView ref or the default import from @mapbox/react-native-mapbox-gl. There's a geoUtils.makeLatLngBounds but the returned object doesn't have an extend method.

kristfal commented 5 years ago

You can use turf.js for getting the bounds of a linestring.