-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update mapbounds logic #175
Conversation
// maps can render more than 1 copies of map at lower zoom level and displays | ||
// one side from 1 copy and other side from other copy at higher zoom level if | ||
// screen crosses internation dateline | ||
function calculateBoundingBoxLngLimit(bounds: LngLatBounds) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement 👍
return lon; | ||
// wrap bounds if only portion of globe is visible | ||
return { | ||
right: bounds.getSouthEast().wrap().lng, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a question here, suppose the current map lng bounding is [-170, 181]
, it is [-170, -179]
after wrapping. It will return
{
right: -179,
left: -170,
}
The query would be
{
bottom_right: {
lon: -179,
lat: ...,
},
top_left: {
lon: -170,
lat: ...,
},
};
Is this what OpenSearch expecting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ruanyl Sorry, do you mean will OpenSearch accept similar to following query or not
{
"DestLocation": {
"bottom_right": {
"lon": -176.8581559092076,
"lat": -38.91257159667413
},
"top_left": {
"lon": -173.24641047835382,
"lat": 78.53889135857452
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VijayanB I mean will OpenSearch return the same results as expected in the bounding box [-170, 181]
after the lng
been wrapped in such case where bottom_right.lon < top_left .lon
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ruanyl Yes.
const boundsMinLng = bounds.getNorthWest().lng; | ||
const boundsMaxLng = bounds.getSouthEast().lng; | ||
// if bounds expands more than 360 then, consider complete globe is visible | ||
if (boundsMaxLng - boundsMinLng >= MAX_LONGITUDE - MIN_LONGITUDE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. SouthEast will always be greater than NorthWest in Maplibre since we are not wrapping.
if more than one copies are visible, use max bounds else wrap bounds. Signed-off-by: Vijayan Balasubramanian <[email protected]>
1ce75fe
Codecov Report
@@ Coverage Diff @@
## main #175 +/- ##
==========================================
+ Coverage 87.50% 87.64% +0.14%
==========================================
Files 6 6
Lines 176 178 +2
Branches 24 24
==========================================
+ Hits 154 156 +2
Misses 16 16
Partials 6 6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
if more than one copies are visible, use max bounds else wrap bounds. Signed-off-by: Vijayan Balasubramanian <[email protected]> (cherry picked from commit 7eb646e)
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.5 2.5
# Navigate to the new working tree
cd .worktrees/backport-2.5
# Create a new branch
git switch --create backport/backport-175-to-2.5
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 7eb646e381337fcc9151d0c881b5b0dbe9ca4f14
# Push it to GitHub
git push --set-upstream origin backport/backport-175-to-2.5
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.5 Then, create a pull request where the |
if more than one copies are visible, use max bounds else wrap bounds. Signed-off-by: Vijayan Balasubramanian <[email protected]>
if more than one copies are visible, use max bounds else wrap bounds. Signed-off-by: Vijayan Balasubramanian <[email protected]> (cherry picked from commit 7eb646e)
if more than one copies are visible, use max bounds else wrap bounds. Signed-off-by: Vijayan Balasubramanian <[email protected]>
Description
if more than one copies are visible, use max bounds else wrap bounds to cover international date line.
Signed-off-by: Vijayan Balasubramanian [email protected]
Issues Resolved
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.