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

Autodetect version from WMS GetCapabilities response #6977

Open
pvgenuchten opened this issue Nov 17, 2023 · 4 comments
Open

Autodetect version from WMS GetCapabilities response #6977

pvgenuchten opened this issue Nov 17, 2023 · 4 comments

Comments

@pvgenuchten
Copy link

pvgenuchten commented Nov 17, 2023

the service https://worldcover2020.esa.int/geoserver/gwc/service/wms is a wms 1.1.1 service only.

terria assumes a 1.3 wms, which fails being added

terria initally sends https://worldcover2020.esa.int/geoserver/gwc/service/wms?version=1.3.0&service=WMS&request=GetCapabilities

which returns (should it better have returned a error?):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE WMT_MS_Capabilities SYSTEM "http://schemas.opengis.net/wms/1.1.1/capabilities_1_1_1.dtd" >
<WMT_MS_Capabilities version="1.1.1">

so far so (almost) good, terria is able to extract the layers

but then sends a wms request including &crs=EPSG%3A900913 (wms 1.3), returning an error 400: No SRS specified (wms 1.1)


this actually works fine if you add the wms url as

https://worldcover2020.esa.int/geoserver/gwc/service/wms?version=1.1.1


suggestion is to auto detect the wms version from the initial capabilities response?
or try 1.3 first, and fall back to wms 1.1.1 if fails

@nf-s
Copy link
Contributor

nf-s commented Dec 15, 2023

It would be nice if Terria auto-detected WMS version from GetCapabilities.

I believe version is a mandatory parameter - so ideally the user specifies a version in url.

I'm not sure what the best approach is here - the way terria handles WMS version is a bit convoluted - I just did a summary for a PR - #6995 (comment)

I am definitely interested in improving this though! I will have a think about it.

Please let me know what you think

@nf-s nf-s changed the title failed adding wms 1.1 only service Autodetect version from WMS GetCapabilities response Dec 15, 2023
@alexgleith
Copy link

When you add a URL like https://example.com/geoserver/gwc/service/wms? Terria is adding the other parameters service=WMS&version=1.3.0&request=GetCapabilities, so I guess GeoWebCache should be failing, but what it does is return the version 1.1.1 response as XML, which I guess is where the confusion is.

It's a bit of overkill, but checking the returned XML for a version is perhaps the robust way to handle it, rather than assuming the server is doing the right thing and returning what was requested!

@lidrakamberi
Copy link

I'm relatively new to the TerriaJS project, and this is my first issue that I'm working on. I'm excited to contribute and learn more about the project!

I've been looking into the issue related to WMS version handling, and I wanted to reach out to @nf-s for some guidance and feedback on the proposed solution.

In essence, my approach involves parsing the initial response when requesting WMS capabilities to extract the version information from the XML. Based on this version, the subsequent WMS requests will dynamically adjust parameters. If the version is 1.1.1, the request will use "SRS"; if it's 1.3.0, it will use "CRS."

I would like to know whether this direction seems appropriate or if there are aspects I should consider or modify.

@pvgenuchten
Copy link
Author

Hi @lidrakamberi, parsing xml (or find substring in text content) to identify version is a good approach, to my understanding terria is already capable to build up a wmsv1.1 vs wmsv1.3 map request, somewhere in the proces the proper wms version needs to be set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants