[Qgis-developer] Is it possible to re-use print composer code to build a web service ?

Martin Dobias wonder.sk at gmail.com
Mon Dec 20 08:59:45 EST 2010


Hi Alessandro

On Mon, Dec 20, 2010 at 2:47 PM, Alessandro Pasotti <apasotti at gmail.com> wrote:
> Hi,
> I've spent a few hours exploring the codebase while I was thinking about
> building a web service to generate (vectorial) PDF for a map.
> IMHO this would be a must, expecially now that QGIS has entered in the web
> service arena with qgis-mapserver.
> The idea is to build a qgis-mapserver companion which would take care of
> building a PDF representation of the map using the configured project(s) and
> a print template.
> The idea is that the user can configure the WMS and print template from QGIS
> GUI, and have a  WMS + PDF-print service running with a few clicks.
> The obvious road for such a service is qgis-mapserver (read layers, map
> extent etc. from request like WMS does), + qgis-print-composer (read the
> template name, the resolutions and paper format from request) but it seems
> like the print-composer cannot work without a GUI, is this correct ?

Marco has refactored the composer code few releases ago, so now it's
possible to use the print composer by calling only qgis_core code.
There is also a simple example how to use the composer:

http://www.qgis.org/pyqgis-cookbook/composer.html#output-using-map-composer

The code saves only a raster image, though saving a PDF should require
only minor modifications of that code. If you will have any problems
adapting it, I'll try to provide also PDF example.

Regards
Martin


More information about the Qgis-developer mailing list