[Qgis-developer] Fail to create raster layer in C++ but is able to do so in python

eliu1234 lby20102 at hotmail.com
Wed Dec 3 17:07:12 PST 2014


I am trying to add a raster layer in c++ application with QtCreator and QGIS
2.6.0. I am currently trying to create a 32bit application under 64 bit
windows system. I am not sure if this would be the cause.

My code is as follows: 
QgsRasterLayer * layer = new
QgsRasterLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer?f=json&pretty=true","raster"); 
However, when I call layer.isValid(), it always return false.

I tried the python equivalent in qgis python console and it works fine. The
python code is as follows: layer =
QgsRasterLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer?f=json&pretty=true","raster");

Any help is appreciated.



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Fail-to-create-raster-layer-in-C-but-is-able-to-do-so-in-python-tp5176356.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list