[Qgis-developer] How to QGIS wms QgsDataSourceURI make?

Kyung-Bae Park kbparkch at gmail.com
Wed Mar 9 23:31:34 PST 2016


Hi qgis-developer group!

I have one question!!!

I'm programmin raster from geoserver wms.
But QGIS cookbook sample wms uri string is error :

ERROR 4:
`IgnoreGetMapUrl=1&format=image/png&layers=ADD_SelfDrivingCar:cell35_07_1_8b3b_AutoCrop&maxHeight=256&maxWidth=256&srs=EPSG:4326&styles=&url=http://192.168.0.21:8080/geoserver/wms
<http://192.168.0.21:8080/geoserver/wms>' does not exist in the file system,


and is not recognised as a supported dataset name.

My source code below :

QgsDataSourceURI uri;

uri.setParam("url", "http://192.168.0.21:8080/geoserver/wms
<http://192.168.0.21:8080/geoserver/wms>");

uri.setParam("format", "image/png");

uri.setParam("crs", "EPSG:4326");

uri.setParam("layers","ADD_SelfDrivingCar:cell35_07_1_8b3b_AutoCrop");

uri.setParam( "maxWidth", "256" );

uri.setParam( "maxHeight", "256");

uri.setParam( "styles", "" );

uri.setParam( "IgnoreGetMapUrl", "1" );

QgsRasterLayer * pRasterLayer = new
QgsRasterLayer(QString(uri.encodedUri()),
"ADD_SelfDrivingCar:cell35_07_1_8b3b_AutoCrop", "wms");

if (pRasterLayer->isValid())

{

qDebug("Raster Layer is valid");

}

else

{

qDeb ug("Raster Layer is NOT valid");

return;

} why this uri is error? please tell me How to make uri string. Please!
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160310/2a1a63a3/attachment-0001.html>


More information about the Qgis-developer mailing list