Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm building a plugin to perform Multi Criteria Analysis (yes another one...). As part of my workflow intersecting vectorlayers is needed. I use QgsOverlayAnalyzer.intersection (a pity union is not yet supported as far as I know).

Because intersection is limited to 2 layers a number of inbetween results is generated. Until now I create these inbetween results as shapefiles, add them to the TOC, use them in another intersection step and eventually remove them later.

Sample code (path, intersectionlayer1 and 2 are defined)

productname= "intersection_output1" # first inbetween result

product = QFileDialog.getSaveFileName(self.pluginGui,"Save inbetween result as", path, "shapefiles (*.shp)")

QgsOverlayAnalyzer().intersection(intersectionlayer1, intersectionlayer2, product, 0)

self.iface.addVectorLayer(product, productname, 'ogr')

Not very elegant and therefore I have a few questions:

  • how to bypass adding the inbetween results to the TOC (QgsMapLayerRegistry requires them isn't it) ? Just using disk as storage is an improvement.
  • how to store these inbetween results in memory (Plugin) layers ? This would improve processing speed and removal of inbetween results is easy.
share|improve this question
Welcome to gis.SE. You might like to use code formatting (as I've done to your post) for future posts. – BradHards Mar 6 '13 at 1:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.