Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The original problem we were seeing was caused by an overly strict
maps
coordinate check which wasn't happy with longitude values > 180 that was fixed here: carbonplan/maps#117Next I noticed that sometimes there were still issues when the same polygon is visible twice on the map (often behind the sidebar) the region picker would sometimes end up on the hidden polygon. To fix this, I went with a simplifying approach - instead of using an exact centroid (which sometimes had the 'wrong' longitude), we're now just using the click coordinates as our center. So now the picker will always show up on the instance of the polygon that was clicked.
If for whatever reason they've navigated/zoomed to a location where the center is not visible, we fly the map there when we initialize the region picker.