2

I am using the print composer plugin for map composition, I want that whenever a user exports the final map, the corner coordinates , label tittle and other attributes I want to push my database. How to I get access to the export Button ?

  • Please post links or code of what you've tried and where specifically you are stuck at. A web search on "pyqgis print composer update or label update should get you started". – artwork21 Aug 29 '16 at 12:09
  • I have searched the web as you suggested , but it is all about using the expressions and updating the label in the print composer, What I am looking for is how to get access of the print composer events so that I can push the metadata to the database. – Ankit Chaudhri Aug 30 '16 at 9:37
  • I'm not seeing a signal under the api for accessing the export menu button. The current composer events signals api are located here: qgis.org/api/classQgsComposition.html – artwork21 Aug 30 '16 at 14:25
  • Thanks for the help. looks like I have to find a work around to solve my problem!!! – Ankit Chaudhri Sep 1 '16 at 6:01
1

You will probably have to create a custom plugin for exporting and writing composer info to db. There are many posts on this form and others for exporting images/pdf, and accessing the map items within the composer. Here are a couple examples:

PyQGIS: Code Scrap for Exporting a QGIS Composer to a Vector PDF

Accessing composer label eg:

mapItem = qgis.utils.iface.activeComposers()[0].composition()
    for item in mapItem.items():
        if isinstance(item,QgsComposerLabel):
            # do something more

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.