Visgl from React-map-gl Repository


Pitch causes coordinate offset [Bug] #2005

Issue Opened
Paulnebel Opened Issue On Sep 29th 2022, 7:05



Setting a value for pitch in V7.0.16 appears to cause a coordinate offset. The images below show a green polygon that contains features. With Pitch set to 0 I can click on said polygon and retrieve the associated features in both V7.0.15 and V7.0.16. However, with Pitch set to anything other than 0 it gets harder to retrieve the features in V7.0.16 as the pitch increases. Beyond a Pitch of 20 or so, I can't retrieve the features at all by clicking on the polygon in V7.0.16 (whereas clicking on the polygon retrieves features at any Pitch in V7.0.15). This issue doesn't occur if the pitch is set as an initial value, but it does occur if you 'flyTo' the polygon from elsewhere in the map.

The issue is best illustrated by the following animated GIFs. The first GIF is V7.0.15, and pitching the image results in the polygon remaining in the centre of the map. However, in the V7.0.16 version we can see the polygon shifting down from the centre of the map as the pitch increases. It seems that the pitch centre is set above ground level, and this appears to be causing a mis-match between screen coordinates and lat/lng.

NOTE: The ONLY difference between the following images is the version of ReactMapGL being use.

V7.0.15 react-map-gl-7 0 15

V7.0.16 react-map-gl-7 0 16

Expected Behavior

Set Pitch = 0 and click on green polygon: Features are returned by map with V7.0.15 & V7.0.16

Set Pitch = 70 and click on green polygon: Features are returned by map with V7.0.15 but FEATURES ARE NOT RETURNED by map in V7.0.16

Steps to Reproduce

The only difference between the working code and the broken code are the version of ReactMapGL in package.json. It works with 7.0.15, it does not work with v7.0.16


  • Framework version: react-map-gl@7.0.16
  • Map library: mapbox-gl@2.8.2
  • Browser: Chrome Version 105.0.5195.125 (Official Build) (arm64)
  • OS: macOS Monterey v12.6


No response

Pessimistress commented on 2 months ago


Can you create a CodeSandbox that reproduces your issue?

About Repository

React friendly API wrapper around MapboxGL JS
Language: TypeScript
Star: 6880
Fork: 1250
Watchers: 6880
Open Issues: 28
Last updated: 05 Dec 2022