Mohammed Rashad wrote:
I am trying to build an online shapefile viewer using qgis as a backend. for that i need to render qgis output to a image(.png) file I cannot use QgsMapCanvas class because it requires QApplication I cannot use any class from qgis_gui
but qgis_core can be used.


QgsVectorLayer * mypLayer = new QgsVectorLayer(myLayerPath, myLayerBaseName, myProviderName); QgsSingleSymbolRenderer *mypRenderer = new QgsSingleSymbolRenderer(mypLayer->geometryType());
  QList<QgsMapCanvasLayer> myLayerSet;
  mypLayer->setRenderer(mypRenderer);

  if (mypLayer->isValid())
  {
    cout << "Layer is valid";
  }
  else
  {
    cout << "Layer is NOT valid";
    return;
  }

the following code works for me in Wt. It prints layer is valid or invalid according to the parameters to QgsVectorLayer() can I set mypLayer->setRenderer of the above code to an image file so that rendering occurs on a image file of my choice?

It hope now the problem is clear.Now can you help me?

Nope, sorry I'm not that deep into cpp coding.

But from what you write it seems that you actually want a WMS. So why not have a look at the mapserver_qgis WMS? This can generate an image from a given qgis-project file for you. It's also probably interesting to look into that code https://svn.osgeo.org/qgis/trunk/qgis/src/mapserver/

Actually I'm also wondering if it would be easy to build a mini python application which:
1) reads a qgs project file (see mapserver export plugin for that)
2) then paints the map on a given hidden mapcanvas of a given size and bbox (this is the hard part I think?)
3) writes this to an image

Maybe somebody else?

Richard
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to