[GIS] WMS not viewing in QGIS

qgiswms

I am trying to import WMS from geoserver link to QGIS 2.8.4 & the latest 2.12.1:
http://geoportal.asig.gov.al/Services/host/host.ashx?url=http://localhost:8080/geoserver/asig/wms&

QGIS get the request and show the layers of the workspace, and also the get info.
My problem is that the layer is not visible in the view.

It works fine with version 2.2:

enter image description here

Best Answer

As far as I can tell this appears to be an error with QGIS stripping the host name off the url; so I get errors in the console like:

Map request failed [error:Protocol "" is unknown url:/Services/host/host.ashx?url=http://localhost:8080/geoserver/asig/ows&&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=345119.95276619656942785,4499106.68403259478509426,503972.04766661184839904,4603200.33713638130575418&CRS=EPSG:32634&WIDTH=640&HEIGHT=419&LAYERS=cz_division&STYLES=&FORMAT=image/png&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE&AspxAutoDetectCookieSupport=1]

I checked the value of the URL stored in the registry something like:

HKEY_CURRENT_USER\SOFTWARE\QGIS\QGIS2\Qgis\connections-wms\your-service-name

And that seems correct

I created a GDAL WMS mini driver (see http://www.gdal.org/frmt_wms.html for all the options) as below

<GDAL_WMS>
    <Service name="WMS">
        <ServerUrl>http://geoportal.asig.gov.al/Services/host/host.ashx?url=http://localhost:8080/geoserver/asig/wms</ServerUrl>
        <ImageFormat>image/png</ImageFormat>
        <Layers>cz_division</Layers>
        <BBoxOrder>xyXY</BBoxOrder>
        <SRS>EPSG:32634</SRS>
        <CRS>EPSG:32634</CRS>
        <Transparent>TRUE</Transparent>
    </Service>
    <DataWindow>
        <UpperLeftX>359060.34375</UpperLeftX>
        <UpperLeftY>4719675.5</UpperLeftY>
        <LowerRightX>505375.90625</LowerRightX>
        <LowerRightY>4387020.0</LowerRightY>
        <SizeX>1024</SizeX>
        <SizeY>1024</SizeY>
    </DataWindow>
    <UserAgent>GDAL WMS driver (http://www.gdal.org/frmt_wms.html)</UserAgent>
</GDAL_WMS>

Then I add this through the add raster layer tool, and I get the map.

So you can use one or more mini drivers to get the maps showing in QGIS, but really you should probably report the issue to QGIS to get a proper fix:

http://hub.qgis.org/projects/quantum-gis/issues

If you look at the layer properties > layer source of a WMS layer that works, for example :

contextualWMSLegend=0&crs=EPSG:4326&dpiMode=2&featureCount=10&format=image/png&layers=BMNG&styles=&url=http://mapsref.brgm.fr/wxs/1GG /monde1GG?

You can see that it chops the request up into several pieces including an url parameter. I think the QGIS issue with the ASIG service is that the ASIG service itself defines an URL parameter.

Related Question