maps icon indicating copy to clipboard operation
maps copied to clipboard

[Bug]: onMapIdle() and getVisibleBounds() returning different values when the displayed map area includes the antimeridian

Open McFly78 opened this issue 2 years ago • 0 comments

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. MapBox Antimeridian Bound

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

McFly78 avatar Dec 15 '23 11:12 McFly78