[Bug]: onMapIdle() and getVisibleBounds() returning different values when the displayed map area includes the antimeridian
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 2.9k
- Forks
- 947
- Avg merge
- 6d 37m
- Merged PRs (30d)
- 1
Description
Mapbox Implementation
Mapbox
Mapbox Version
default
Platform
iOS
@rnmapbox/maps version
10.0.5
Standalone component to reproduce
import React, {createRef} from 'react';
import {
MapView,
} from '@rnmapbox/maps';
class BugReportExample extends React.Component {
constructor(props) {
this.mapboxMapsView= createRef()
}
_mapBoxOnMapIdle (mapInfo){
console.log (mapInfo.properties.bounds)
this.mapboxMapsView.current.getVisibleBounds ()
.then (infos => {
console.log (infos)
})
}
render() {
return (
<MapView ref={this.mapboxMapsView} style={{flex: 1}} projection= 'mercator' onMapIdle= {this._mapBoxOnMapIdle}>
</MapView>
)
}
}
Observed behavior and steps to reproduce
Hi,
I have noticed a difference between the north-east / south-west bounding region returned by onMapIdle() event and getVisibleBounds() function when the displayed map area includes the antimeridian.
I would expect the results to be the same but maybe is it a normal behaviour ?
Please find the results I get when I display the map area indicated on the image:
getVisibleBounds() -> OK
LOG [[-110.15258915742656, 84.1598150884675], [117.52820754359982, -21.978300538933524]]
mapInfo.properties.bounds -> NOK
LOG {"ne": [117.52820754359982, 84.1598150884675], "sw": [-110.15258915742656, -21.87417594058914]}
As you can see the longitudes values in properties.bounds are reversed between North-East and South-West points.
Expected behavior
The results should be the same using getVisibleBounds() or properties.bounds values.
Notes / preliminary analysis
No response
Additional links and references
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the iOS Mapbox implementation behind MapView's onMapIdle() and getVisibleBounds() entry points, using the supplied reproduction and antimeridian coordinates. Done means both APIs return equivalent north-east and south-west bounds for the displayed map area.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100