[Qgis-developer] Automatizing map making

Tim Sutton lists at linfiniti.com
Mon Sep 17 23:24:46 PDT 2012


Hi

On Tue, Sep 18, 2012 at 1:07 AM, Pedro Camargo <veigacamargo at gmail.com> wrote:
> Hi,
>      I have been using QGIS for a few months now after almost a decade using
> Maptitude and TransCAD (from Caliper Corporation).
>
>      Now that I already know how to get around pretty well with QGIS, I want
> to use it to production of series of maps (from a few dozens to hundreds at
> a time).
>
>      My current problem is to make simple maps with graduated style and
> fixed classes for several different fields on the database.
>
>    Looking at the PyQGIS documentation helped a bit, but I got several
> errors like "NameError: name 'QtGui' is not defined" and for many other
> names/libraries in the sample code I used, so I'm pretty sure that I have
> something missing that was not mentioned in the documentation or that I
> missed.
>
>    Further, I'm interested in making maps with fields that are not in the
> database, so I need to make a join too (which is not mentioned anywhere in
> the documentation I saw).
>
>     I would imagine that there is a way to open a project, change something
> (like the fields for the graduate rendenring), update the map composer and
> save the jpg, but I didn;t see anything like that...
>
>     Did anybody face a situation like this? Any recomendations?  Any sample
> code you could share?
>

Here is a nice code sample of creating a complex map using QGIS 1.8 api.

https://github.com/AIFDR/inasafe/blob/master/safe_qgis/map.py

Also look at the source of the Atlas plugin. Note that in master
things get considerably easier for creating a map in python since you
can use a lot more templating etc. There are some unit tests which
should provide a nice reference guide:

https://github.com/qgis/Quantum-GIS/blob/master/tests/src/python/test_qgscomposermap.py
https://github.com/qgis/Quantum-GIS/blob/master/tests/src/python/test_qgscomposerhtml.py

It is better to write coding related questions to the dev list in my
opinion. It would alse be good if you mentioned what OS and QGIS
versions you are using when you write such emails so that we can give
you platform specific advice. It looks very much like the Qt4 python
modules are not in your path or are not installed.

Regards

Tim



> Thanks for the help,
>
> Pedro
> UC Irvine
>
>
>
>
> PS - Sorry for posting in two lists, but I really have no idea where to send
> this e-mail.
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



-- 
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================


More information about the Qgis-developer mailing list