<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><br><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><div class="y_msg_container">Hi<div id="yiv0648105851"><div><div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;"><div><br></div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;">This is my first attemp with QGIS. I'm using 2.0 version.</div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;">My first goal is a proof of concept with a wms map and a vector map.</div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica,
sans-serif;background-color:transparent;font-style:normal;">I started with the wms service. You'll find the code below, there are two</div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;">things that
don't go well.</div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;"><br></div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;">First, QgsApplication::applicationVersion() is "", Did I do something wrong in <br></div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;">initialization ?<br></div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;"><br></div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;">Second, my wms layer is not valid but maybe it is only because of the
first question...<br></div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;"><br></div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;"><br></div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;">main.cpp</div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;">int main(int argc, char *argv[])<br>{<br> QgsApplication app(argc, argv, TRUE);<br> MainWindow w;<br> w.show();<br> <br> return app.exec();<br>}<br><br></div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica,
sans-serif;background-color:transparent;font-style:normal;"><br></div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;">mainwindow.cpp</div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;"><br></div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;">MainWindow::MainWindow(QWidget *parent) :<br> QMainWindow(parent),<br> ui(new Ui::MainWindow)<br>{<br> ui->setupUi(this);<br> QgsApplication::setPrefixPath("/usr/lib/qgis", false);<br> QgsApplication::initQgis();<br> qDebug()<<
QgsApplication::applicationVersion(); // <<------------------- return empty string<br><br> mapCanvas = new QgsMapCanvas(this);<br> mapCanvas->enableAntiAliasing(true);<br> mapCanvas->useImageToRender(false);<br> mapCanvas->setCanvasColor(QColor(255, 255, 255));<br> mapCanvas->freeze(false);<br> mapCanvas->setVisible(true);<br> mapCanvas->refresh();<br> mapCanvas->show();<br><br> QVBoxLayout* lyt = new QVBoxLayout(ui->centralWidget);<br> lyt->addWidget(mapCanvas);<br><br> QString uri = "crs=EPSG:4326&featureCount=10&format=image/gif&layers=osm_auto:all&styles=&url=http://129.206.228.72/cached/osm";<br> QgsRasterLayer* rlayer = new QgsRasterLayer(uri, "test",
"wms", true);<br> if (!rlayer->isValid()) qDebug() <<"invalid wms"; // <<--------------------- It is invalid !<br><br> QgsMapLayerRegistry::instance()->addMapLayer(rlayer);<br><br> mapCanvas->layers().append(rlayer);<br> mapCanvas->zoomScale(1/10000);<br> mapCanvas->centerOn(5.7, 45.2);<br> mapCanvas->update();<br>}</div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;"><br></div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;">Thanks for your help.</div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;
font-style:normal;">Regards</div><div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;background-color:transparent;font-style:normal;">Juliette</div></div></div></div><br><br></div> </div> </div> </div></body></html>