Skip to content
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

Stand-alone GeoWebCache WMS-support in Hajk admin and client #1469

Closed
sweco-semara opened this issue Feb 8, 2024 · 5 comments · Fixed by #1493
Closed

Stand-alone GeoWebCache WMS-support in Hajk admin and client #1469

sweco-semara opened this issue Feb 8, 2024 · 5 comments · Fixed by #1493
Labels
module:admin module:client/core Core functionality (not a plugin) new feature Request for adding/changing functionality
Milestone

Comments

@sweco-semara
Copy link
Contributor

sweco-semara commented Feb 8, 2024

Describe the bug
Hajk is currently not able to integrate with stand-alone instances of GeoWebCache ("GWC") for WMS services, there are a couple of assumptions being made that only a GeoServer-bundled GeoWebCache will fulfill. E.g:

  1. Hajk new-admin assumes GeoServer REST endpoint availability for listing WMS server workspaces. Workspace list endpoint is not available in stand-alone GeoWebCache instance (at least not on the same endpoint).
  2. Hajk new-admin failes to parse GeoWebCache GetCapabilities response in full WMS mode, in order to list published projections. This results in Hajk new-admin not being able to integrate with non-EPSG:3009 GeoWebCache WMS since projection selection dropdown will be empty. SWEREF 99 TM/EPSG:3009 seems to be assumed regardless of map default projection in that case.

To Reproduce

  1. Start a GeoWebCache stand-alone instance, with full WMS mode and at least one layer with a specific projection
  2. Use Hajk admin and try to add the WMS

Expected behavior
Hajk new-admin can be improved to reflect stand-alone GeoWebCache behaviour, i.e:

  1. Not enable the user to click "List workspaces" since GWC lacks this capability
  2. Be able to parse projections published from capabilities and fill the drop-down for projection selection (this could also be generic for WMS-C response, to be investigated)

Additional context

  • This issue will be detailed as the work with a patch to solve these issues progresses.
  • Current idea is to "qualify" stand-alone GeoWebCache as a distinct server-type in Hajk's new-admin e.g. geowebcache-standalone (see discussion in comments).
@sweco-semara
Copy link
Contributor Author

@Hallbergs @jacobwod I am trying to get a customer to see the benefit of Sweco contributing to Hajk for making Hajk-integration with stand-alone GWC smoother. If accepted, let's discuss solutions on upcoming code meetings. Heads-up with the idea of "qualifying" GeoWebCache to it's own Server Type in Hajk admin. Do you agree with that idea? Would you choose "geowebcache" or "geowebcache-standalone" in that case? (All other server types seems to be lowercase only in Hajk admin so my initial suggestion follows this principle.) NB! Bug report is not really complete yet, more details will follow.

@jacobwod
Copy link
Member

jacobwod commented Feb 8, 2024

Thanks @sweco-semara, I absolutely agree. Also, you're correct about the assumptions made in Admin's code. It seems like nobody really tested standalone GWC before, hence the missing support. It'd be fantastic to get it implemented.

Given the differences that you've identified, it seems valid to add another serverType. I'd vote for geowebcache-standalone, given that it's less ambiguous and states clearly that it targets the standalone GWC. But you can call it whatever you prefer. 😄

We can absolutely talk about it on the upcoming meeting. 👍

@jacobwod jacobwod added module:client/core Core functionality (not a plugin) module:admin bug new feature Request for adding/changing functionality labels Feb 8, 2024
@jacobwod
Copy link
Member

jacobwod commented Feb 8, 2024

I've added some labels, please correct if I'm mistaken (specifically I'm not sure if this will require work in Client and Backend too).

@sweco-semara sweco-semara changed the title GeoWebCache: Hajk issues with stand-alone GWC WMS integration Stand-alone GeoWebCache WMS-support in Hajk admin and client Feb 22, 2024
@sweco-semara sweco-semara removed the bug label Feb 22, 2024
sweco-semara added a commit to sweco-se/hajk-fork that referenced this issue Feb 22, 2024
* Add support for new WMS server type "geowebcache-standalone"
* Use constants for WMS versions and server types
* Add optional support for configuring default server type as well as the existing default URL (fall back to "geoserver" if not present/backwards compatible)
sweco-semara added a commit to sweco-se/hajk-fork that referenced this issue Feb 22, 2024
sweco-semara added a commit to sweco-se/hajk-fork that referenced this issue Feb 23, 2024
@sweco-semara
Copy link
Contributor Author

sweco-semara commented Mar 25, 2024

This was tested successfully against a standalone GWC instance in dev, test and prod environments. Starting to clean up code and proceed with the PR.

Core devs, for your information (initially a question but changed on second thought, see potential downsides below - moved to potential future work instead) Seeing where the implementation landed the changes might, with small adjustments, be extrapolated from GeoWebCache stand-alone to some generic "WMS server but not GeoServer" setting, i.e. Any WMS Server, not having the GeoServer REST API available for listing workspaces. The servertype name could then be changed, I guess e.g. QGIS Server would behave similar, to a bit more generic (e.g. from "geowebcache-standalone" to generic-wms).

Potential downsides and reasoning against proceeding with generalization of all non-GeoServer WMS types already now, i.e. the reason to go ahead with proven "geowebcache-standalone" only for a first PR:

  1. Not yet tested with other servertypes
  2. GeoWebCache not supporting serveral WMS service versions and an assumption in admin to not query for all versions (GWC will not care if WMS version 1.3.0 is requested for capabilties, it will incorrectly respond with 1.1.1 syntax and HTTP/200 OK status which is not WMS spec conformant)
  3. Setting servertype = geowebcache-standalone currently automatically sets tiled=true in Hajk admin

The new GWC stand-alone support and existing QGIS Server type will be a good base for generalization in a future Hajk improvement, GWC stand-alone PR could be a good starting point for "extracting up"/generalizing to a common server type for "geowebcache-standalone" + "qgis" to e.g. "generic-wms". Hower due to reasons above this might be complicated with e.g. WMS version defaults, so leaving it as-is for now with the proven and tested GWC stand-alone support.

sweco-semara added a commit to sweco-se/hajk-fork that referenced this issue Mar 26, 2024
* Resolves hajkmap#1469
* Add support for new WMS server type "geowebcache-standalone"
* Add optional support for configuring a default server type, as well as existing option for default URL (backwards compatible, falls back to "geoserver" if not present)
* Re-name admin WMS option from "GeoWebCache" to tiled (since WMS-C tiled mode has nothing to do with GeoWebCache and it's now a supported server type, making the old admin title for tiled option very confusing)
* Use constants for WMS versions and server types
* Avoid non-conformant WMS v1.3.0 GetCapabilities for geowebcache-standalone server type
* Automatically default to tiled loading for geowebcache-standalone server type
* Spellcheck admin sv-SE labels for queryable layers ("klick")

More robust WMS admin, guard against GetCapabilties load failures or format errors
* Console warning if unsupported spatial reference system found in WMS capabilities
* Fix: Async load could crash WMS admin if clicking too fast on layers/capabilities, not ready for projections update
* Fix: Do not reference undefined objects in admin after failed GetCapabilities
* Fix: Handle failed net requests e.g. due to CORS-block, instead of crashing admin
* Fix: Handle API failures for getting layers config gracefully (e.g. API endpoint version mismatch), instead of crashing admin
* Fix: Handle HTML responses with 200/OK for failed GetCapabilities (like e.g. Hajk development mode and GeoServer proxy)
@sweco-semara
Copy link
Contributor Author

PR is now ready for review. It includes several improvements for avoiding Hajk admin crashing on all sorts of configuration errors thrown at it during testing, including CORS block / WMS servers missing CORS headers for Hajk which has been a pretty common error in our customer's test and productions environments (before pointing this out).

@jacobwod jacobwod added this to the 3.13 milestone Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:admin module:client/core Core functionality (not a plugin) new feature Request for adding/changing functionality
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants