Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_3_0": ["                  <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2015 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \r\n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2015.5.22.2603\r\n            </div>\r\n            \r\n        </div>\r\n    </div>\r\n    <noscript>\r\n        <div id=\"noscript-warning\">Geographic Information Systems Stack Exchange works best with JavaScript enabled<img src=\"http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif\" alt=\""], "copyright__copyright__copyright": ["ew questions:\n\n  \u2022 how to bypass adding the inbetween results to the TOC (QgsMapLayerRegistry requires them isn't it) ? Just using disk as storage is an improvement.\n  \u2022 how to store these inbetween results in memory (Plugin) layers ? This would improve processing speed and removal of inbetween results is easy.\nshare|improve this question\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nBrowse other questions tagged or ask your own question."]}