-
Notifications
You must be signed in to change notification settings - Fork 919
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
Fixes maps wms zoom limitation #1915
Fixes maps wms zoom limitation #1915
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1915 +/- ##
==========================================
+ Coverage 67.48% 67.49% +0.01%
==========================================
Files 3076 3076
Lines 59144 59144
Branches 8989 8989
==========================================
+ Hits 39915 39921 +6
+ Misses 17044 17040 -4
+ Partials 2185 2183 -2
Continue to review full report at Codecov.
|
@@ -164,7 +164,7 @@ export function BaseMapsVisualizationProvider() { | |||
|
|||
try { | |||
if (this._wmsConfigured()) { | |||
if (WMS_MINZOOM > this._opensearchDashboardsMap.getMaxZoomLevel()) { | |||
if (WMS_MAXZOOM > this._opensearchDashboardsMap.getMaxZoomLevel()) { |
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.
Good catch! Thanks for the fix.
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.
Why do we need to also reset the min zoom level in this case (L168)? It seems like maybe the min and max zoom levels should each be reset under different conditions.
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.
Could we get more insight the original logic here and the original intent and ensure a regression isn't happening by changing this? Seems like code that has existed since even before the legacy version 6.x and it's changing the value.
From my understanding the original code was checking if the max zoom level was less than 0 then it would reset the min and max to 0 and 22.
Now the logic is if 22 > than max zoom level then it will always set the max zoom level to 22. So it seems regardless of what the map is configure to it will always set the max zoom level to 22 even if the user's WMS does not support a zoom level of 22?
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.
Hi @kavilla, There was a same issue reported at Kibana 7.1.1 at 2019 elastic/kibana#49709. From that issue context, we could see the WMS zoom level limitation wasn't correct in some versions and didn't get fixed.
Based on this previous PR on Kibana elastic/kibana@4e2401c#diff-8eef4c226bf8f716c6420fcec4400202088971b418cb9bc31bdc4cecb57bc365R117, I still think it's designed to checking with max zoom level with current existing max zoom level which is from opensearch maps service max zoom level.
If we don't set up the WMS_MAXZOOM to 22, the maps max zoom would firstly be set and limited by default maps service max zoom. So in order to make sure all WMS users are able to load their WMS tiles at max potential zoom level, we need to set up max zoom limitation to 22.
Hi @joshuarrrr, the code logic already exist since kibana, in my understand, here for WMS cases, it can make sure users always have zoom level from 0 - 22.
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.
Hi @junqiu-lei, yeah the bug makes sense in that it checks the maps service and defines the max zoom level which doesn't make sense if WMS is defined and it should use WMS configurations.
But I think this logic is intentional to be the case somehow that value returns as a negative and then it has some default case that at least set the same level from a valid (non-negative) value. But with change, regardless what the user configures for max zoom we will always set max zoom to 22. This seems like it addresses the bug as much is the increases the maximum to 22 instead of 10. It also prevents the edge case where that max zoom is a negative value. If somehow the value returned is negative for max zoom then max zoom would be negative.
So is the bug actually occurring at another location? Because I see earlier in the file the map gets configured with these default values and it must be overwritten, but in the rest of this function it sets the options that were configured so perhaps that value is not being applied or the previous base layer needs to be nulled out for WMS to take those settings?
If that becomes to hairy, I'd rather keeps this logic and add a new conditional that does what you added while keeping intact the previous condtion.
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.
Hi @kavilla, I updated the WMS zoom check condition to include both existing check and bug fix check, so that we can fix the bug and avoid abandon the existing logic.
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.
LGTM! Thanks
Do we have unit/any other type of tests in this project? If so I think we need to update tests and add checks for edge cases like min/max values |
I didn't find any existing test file for |
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.
LGTM
@martin-gaievski We do have functional tests that test min/max zoom levels - see https://github.com/opensearch-project/OpenSearch-Dashboards/pull/1823/files, for example. |
Hi Josh, thanks for catching, I think the tests here are for default maps tiles zoom levels, not includes WMS, let me check if we can add the WMS zoom test here. |
@@ -164,7 +164,7 @@ export function BaseMapsVisualizationProvider() { | |||
|
|||
try { | |||
if (this._wmsConfigured()) { | |||
if (WMS_MINZOOM > this._opensearchDashboardsMap.getMaxZoomLevel()) { | |||
if (WMS_MAXZOOM > this._opensearchDashboardsMap.getMaxZoomLevel()) { |
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.
Could we get more insight the original logic here and the original intent and ensure a regression isn't happening by changing this? Seems like code that has existed since even before the legacy version 6.x and it's changing the value.
From my understanding the original code was checking if the max zoom level was less than 0 then it would reset the min and max to 0 and 22.
Now the logic is if 22 > than max zoom level then it will always set the max zoom level to 22. So it seems regardless of what the map is configure to it will always set the max zoom level to 22 even if the user's WMS does not support a zoom level of 22?
Hi @kavilla, how do you think based on my last comment? We can have a offline quick sync about the WMS part code from Kibana if you think it's needed. Then I can update the PR with functional tests coordinately. |
9609ff3
Signed-off-by: Junqiu Lei <junqiu@amazon.com>
9609ff3
to
e615a77
Compare
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.
Thanks!
When using WMS to customize base tile maps in region map or coordinate maps, user aren’t able to get into higher zoom levels than opensearch maps service default maximum zoom level. Issue Resolved: opensearch-project/maps#19 Signed-off-by: Junqiu Lei <junqiu@amazon.com> (cherry picked from commit 4dd7f14)
When using WMS to customize base tile maps in region map or coordinate maps, user aren’t able to get into higher zoom levels than opensearch maps service default maximum zoom level. Issue Resolved: opensearch-project/maps#19 Signed-off-by: Junqiu Lei <junqiu@amazon.com> (cherry picked from commit 4dd7f14) Co-authored-by: Junqiu Lei <junqiu@amazon.com>
Signed-off-by: Junqiu Lei junqiu@amazon.com
Description
When using WMS to customize base tile maps in region map or coordinate maps, user aren’t able to get into higher zoom levels than opensearch maps service default maximum zoom level.
By this PR fixed, the WMS max zoom value can be reached to 22 which is originally deigned here
Issues Resolved
opensearch-project/maps#19
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr