setBounds zooms to incorrect location when over antemeridian
See original GitHub issueIf you call setting bounds on the camera with coordinates crossing the antemeridian (eg { ne: [150, 20], sw: [-179, -20] }
it zooms to the map as if the bounds had west and east swapped (eg { ne: [-179, 20], sw: [150, -20] }`. Instead it should zoom the map to the area crossing the antemeridian (line at ±180 lon).
To Reproduce use the starter instructions, and the following map code
<MapboxGL.MapView style={styles.map} >
<MapboxGL.Camera bounds={{
ne: [150, 20],
sw: [-179, -20],
}}/>
</MapboxGL.MapView>
this zooms here:
Expected behavior it should zoom to a region in the pacific eg
Versions (please complete the following information):
- Platform: both
- Device: iPhone X
- Emulator/ Simulator: yes
- OS: iOS 13.4.1
- react-native-mapbox-gl Version [e.g. 7.0.9]
- React Native Version 0.62.2
This could be a problem inside of mapbox itself, im not too sure how the camera/zooming works
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
setBounds zooms to incorrect location when over antemeridian
Instead it should zoom the map to the area crossing the antemeridian (line at +-180 lon). ... Versions (please complete the following information):....
Read more >JComponent.setBounds the last JComponent in the wrong place
I don't see a layout being set on the Frame, so I assume it has the default one, but the swingPanel is clearly...
Read more >avarice - OSCHINA - 中文开源技术交流社区
Let's talk about the demand side first. Most software is not sold in boxes, available on the Internet, or downloaded from the App...
Read more >Full text of "Significant etymology; or, Roots, stems, and ...
This word, which includes all things both in the heavens and on the earth, ... of God and divine things {theos) ; zoology,...
Read more >dictionary.txt - Eclipse Git repositories
... align setbounds setcolor setfont setheight setindentation setleftmargin ... liter liters localization localization's localizations localize localized ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In MapboxGL it’s implemented with setVisibleCoordinatesBounds. Just add 360 to the Western Longitude.
e.g. to show Japan and Mexico: LongitudeNE: 128.43 LongitudeSW: 273.19
So you just need a React Native Wrapper for that method. I did a quick and dirty version with custom data types for my project, but have a look for some inspiration: https://github.com/jaysquared/maps/commit/7d369a77d6bd5d8cafdda6d776b81e982f4d48a5
To calculate out of an array of Coordinates / CoordinateBounds I use this method:
Reopening this, as it’s a legitimate issue