QGIS WMS Layer – Troubleshooting QGIS Failure to Load WMS Layer

getcapabilitiesqgiswms

I am trying to load WMS from the URL https://vedas.sac.gov.in/geoserver/vedas/wms/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities

While this URL works on the website https://vedas.sac.gov.in/desertification/index.html, it does not work when I use the URL in QGIS 3.22.12. QGIS throws an error: 'Failed to parse capabilities.'

The error report marks the error in the requested XML at line 27817. Is there any way to still access the layer without the server admin deleting the said layers?


Could not get WMS capabilities: invalid name for processing instruction at line 27817 column 21
This is probably due to an incorrect WMS Server URL.

Best Answer

For WMS 1.3.0, take a copy of the XML output, delete the corrupted forest_biomass_karnataka layer and add </Layer></Capability></WMS_Capabilities> to the end of the file. The file is still invalid at this point though. Several Style sections are missing required Title elements, such as vedas:rh_forecast, vedas_dvi:aizwal_pie, India_wetland_2017_18, vedas:rh_forecast there are others... you can add in an empty element <Title/>

A couple of eastBoundLongitude elements have values greater the 180, which is not permitted, so change those to 180.

Now you have a valid capabilities response, but you should go further.

Change all http://192.168.2.17:8090/ references to https://vedas.sac.gov.in/ except the GetCapabilities URL at: /WMS_Capabilities/Capability[1]/Request[1]/GetCapabilities[1]/DCPType[1]/HTTP[1]/Get[1]/OnlineResource[1]/@*[namespace-uri()='http://www.w3.org/1999/xlink' and local-name()='href'] which should point to your saved capabilities file on your local server, for example I changed mine to http://localhost/test/verdas130.xml

Service works in QGIS