Friday 27 February 2015

pyqgis - Printing centered map from a QGIS project for each point in shapefile?


I need to produce on the order of 100 maps that are centered on each point of interest in a shapefile. I would like to prepare all the layers in a master QGIS project, and set up the composition for one point (so that printing 100 maps could be done manually, if need be).



I'd have something like the following layers:



  • basemap

  • points

  • point buffer


And I would like to then automate printing to svg something like:



  1. For each point in a shapefile

  2. Center the map canvas on that point


  3. Filter a buffer layer to only have that point

  4. Print an svg with composition from the map composer


I'm reasonably certain I know how to do 1 & 2, but haven't found details on 3 & 4 on this site.



Answer




  1. In the print composer, enable atlas and use point layer as atlas coverage layer.

  2. Set the map item to be controlled by atlas, and choose the fixed scale


  3. Back in the QGIS's main window, for each layer that you want to filter according to a certain distance to the point use the rule based symbology and use the following rule



    within($geometry, buffer(@atlas_geometry, distance))




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...