1

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.

1
  • Not a QGIS issue, issue is all on the GeoServer server for having an invalid response
    – nmtoken
    Dec 1, 2022 at 11:09

2 Answers 2

2

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

1

This is a very large and horrible capability response document that generates a Java exception on output. But if you download the xml File and replace lines 27815-27820 with the following lines, it may be possible to load some layers if you drag the file into map canvas.

27815:    </Layer>
27816:  </Capability>
27817:</WMT_MS_Capabilities>
2
  • I did do this on my own and tried to load the same in QGIS just before coming here again. Got a new error: The file is not a WMS connections exchange file. Is that cause the last closing tag should be </WMT_MS_Capabilities version="1.1.1" updateSequence="459904">instead of the plain </WMT_MS_Capabilities>?
    – OverArch
    Nov 22, 2022 at 10:10
  • No </WMTS_MS_Capabilities> is enough. But you can check the XML with gdalinfo as well. In OSGeo4W Shell enter "gdalinfo <your XML file>".
    – christoph
    Nov 22, 2022 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.