Skip to content

Fix printing WMTS background layers loaded at startup (#7705)#7706

Merged
offtherailz merged 5 commits intogeosolutions-it:masterfrom
landryb:fix/7705-wmts-print
Jan 25, 2022
Merged

Fix printing WMTS background layers loaded at startup (#7705)#7706
offtherailz merged 5 commits intogeosolutions-it:masterfrom
landryb:fix/7705-wmts-print

Conversation

@landryb
Copy link
Copy Markdown
Contributor

@landryb landryb commented Jan 4, 2022

default requestEncoding to KVP

Description

try fixing some of the issues printing WMTS layers

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix

Issue

What is the current behavior?

#7705

What is the new behavior?

printing a WMTS background layer loaded at startup works

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

note that this is only part of the fix, it doesnt fix printing WMTS layers coming from non-geoserver services such as mapproxy, for which getDefaultStyleIdentifier returns null.

@landryb
Copy link
Copy Markdown
Contributor Author

landryb commented Jan 4, 2022

fwiw, even if eslint chokes on my style (and the error makes no sense to me):

/home/runner/work/MapStore2/MapStore2/web/client/utils/WMTSUtils.js
Error:   110:16  error  Unnecessary 'else' after 'return'  no-else-return

i've tested the resulting war locally built by backporting those 3 commits to ms2-geor, and that fixes the two distinct WMTS printing issues i was seeing. There are probably more here and there, but from my side that's already an improvement.

@tdipisa
Copy link
Copy Markdown
Member

tdipisa commented Jan 7, 2022

@landryb thank you for your contribution. A reviewer has been assigned, we will review this PR as soon as possible. I've just noticed few failing tests that maybe you want to check in the meantime.

@landryb
Copy link
Copy Markdown
Contributor Author

landryb commented Jan 17, 2022

I've just noticed few failing tests that maybe you want to check in the meantime.

fwiw that's what i had put in my previous comment, i have no idea why eslint chokes on this else. Or maybe the else should just be dropped completely, but those coding rules feel a bit strange.

@offtherailz
Copy link
Copy Markdown
Member

This is the detail of the rule:

https://eslint.org/docs/rules/no-else-return

If the "if" blocks contains a return, the else is an unnecessary block.
It took a little to me too to understand. ;)

Example:

if (condition) {
  return x;
} else {
  // do y
}
return z;

is the same of

if (condition) {
  return x;
}
// do y
return z;

So the else is unnecessary and it may complicate the code reading.

@tdipisa tdipisa added the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Jan 24, 2022
Copy link
Copy Markdown
Member

@offtherailz offtherailz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for contributing.
I tested with the WMTS services you provided and it works. I don't see any problem applying this changes.
I added a unit test for you. Let's wait the checks to merge

@offtherailz offtherailz merged commit f24d253 into geosolutions-it:master Jan 25, 2022
@offtherailz
Copy link
Copy Markdown
Member

offtherailz commented Jan 25, 2022

@ElenaGallo, could you please test this on DEV ? Thank you

You can test you can now print layers from these two WMTS services
https://tiles.craig.fr/ortho/service
https://wmts.craig.fr/ortho/service
Another server to test is the following: (you need to customize localConfig.json --> proxy --> useCors to add "https://wxs.ign.fr" to the list. )
https://wxs.ign.fr/essentiels/geoportail/wmts?SERVICE=WMTS&REQUEST=GetCapabilities

@ElenaGallo
Copy link
Copy Markdown
Contributor

Test passed, @offtherailz please backport to stable branch.

@landryb
Copy link
Copy Markdown
Contributor Author

landryb commented Jan 25, 2022

thanks @offtherailz for the merge !

to fully test the default value for requestEncoding one should test printing layers coming from https://wxs.ign.fr/essentiels/geoportail/wmts?SERVICE=WMTS&REQUEST=GetCapabilities which isnt mapproxy (and is also extensively used in ms2-georchestra instances)

tiles & wmts.craig.fr are aliases for our mapproxy service.

@offtherailz
Copy link
Copy Markdown
Member

Thank you @landryb for the hint, i improved my test description and verified that it worked

MV88 pushed a commit that referenced this pull request Jan 28, 2022
…#7794)

Co-authored-by: Landry Breuil <landryb@users.noreply.github.com>
@tdipisa tdipisa removed the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Jan 28, 2022
landryb added a commit to georchestra/mapstore2-georchestra that referenced this pull request Feb 2, 2022
landryb added a commit to georchestra/mapstore2-georchestra that referenced this pull request Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants