React-native-mapbox-gl: Calculate displayed region bounding box using onRegionDidChange payload?

Created on 22 Oct 2017  路  1Comment  路  Source: nitaliano/react-native-mapbox-gl

According to the docs, this payload looks something like

{
  latitude: 37.88481197416011,
  longitude: -122.6450788677475,
  zoomLevel: 12,
  direction: 0,
  pitch: 0,
  animated: false
}

is there an easy way to calculate a bounding box (minLat, minLng) and (maxLat, maxLng) of the newly visible region using the latitude, longitude, and zoomLevel values?

Most helpful comment

Ah, should've googled this earlier. Looks like mapbox published another package that helps with this exact thing https://github.com/mapbox/geo-viewport#boundsviewport-zoom-dimensions-tilesize

>All comments

Ah, should've googled this earlier. Looks like mapbox published another package that helps with this exact thing https://github.com/mapbox/geo-viewport#boundsviewport-zoom-dimensions-tilesize

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VentsislavDinev picture VentsislavDinev  路  3Comments

EugenePisotsky picture EugenePisotsky  路  4Comments

smoll picture smoll  路  4Comments

Gp2mv3 picture Gp2mv3  路  3Comments

madroneropaulo picture madroneropaulo  路  4Comments