problem when open a raster layer

المشرف العام

Administrator
طاقم الإدارة
i am a news user with qgis api c++in order to feel good with it i try some little program to explore class

i have download the tutorial 4 of the qgis and adapted it to the 2.8 version but when i call the connect addlayer i have an error message like layer is not valid

here is the code i use :

QString myRasterFileName = "SR_50M_alaska_nad.tif"; QString MyRasterPath = "/home/flodev/cartes/";

QString MyRaster = myRasterFileName + myRasterFileName;

QFileInfo myRasterFileInfo(MyRasterPath+myRasterFileName);

QString myBaseNameQString = myRasterFileInfo.baseName();

QgsRasterLayer * myRasterLayer = new QgsRasterLayer(MyRaster,myBaseNameQString);

qDebug() isValid()) { qDebug("Layer is valid"); } else { qDebug("Layer is NOT valid"); return; }

i don't know what's wrong.if youn have any ideathe raster file is the file given in the tutorial directory and code is adapted from tutorial4.html



أكثر...
 
أعلى