Skip to main content
sorry, currentLayer() is the right method for mapCanvas() !
Source Link
lrssvt
  • 1.9k
  • 13
  • 10

You have different ways to get what you want by PyQGIS Console:

  1. Aragon's suggestion;
  2. by using QgsGeometryAnalyzer class:
from qgis.utils import iface from qgis.analysis import QgsGeometryAnalyzer mc = iface.mapCanvas() layer = mc.activeLayercurrentLayer() QgsGeometryAnalyzer().buffer(layer, "path_to/output.shp", 500, False, False, -1) 
  1. by using Sextante class:
from sextante.core.Sextante import Sextante Sextante.runalg("ftools:fixeddistancebuffer","input_path.shp", False, 500, 5, True, "output_path_buffer.shp") 

To get the sextante parameters type Sextante.alghelp("ftools:fixeddistancebuffer") in PyQGIS Console.

Hope this helps !

You have different ways to get what you want by PyQGIS Console:

  1. Aragon's suggestion;
  2. by using QgsGeometryAnalyzer class:
from qgis.utils import iface from qgis.analysis import QgsGeometryAnalyzer mc = iface.mapCanvas() layer = mc.activeLayer() QgsGeometryAnalyzer().buffer(layer, "path_to/output.shp", 500, False, False, -1) 
  1. by using Sextante class:
from sextante.core.Sextante import Sextante Sextante.runalg("ftools:fixeddistancebuffer","input_path.shp", False, 500, 5, True, "output_path_buffer.shp") 

To get the sextante parameters type Sextante.alghelp("ftools:fixeddistancebuffer") in PyQGIS Console.

Hope this helps !

You have different ways to get what you want by PyQGIS Console:

  1. Aragon's suggestion;
  2. by using QgsGeometryAnalyzer class:
from qgis.utils import iface from qgis.analysis import QgsGeometryAnalyzer mc = iface.mapCanvas() layer = mc.currentLayer() QgsGeometryAnalyzer().buffer(layer, "path_to/output.shp", 500, False, False, -1) 
  1. by using Sextante class:
from sextante.core.Sextante import Sextante Sextante.runalg("ftools:fixeddistancebuffer","input_path.shp", False, 500, 5, True, "output_path_buffer.shp") 

To get the sextante parameters type Sextante.alghelp("ftools:fixeddistancebuffer") in PyQGIS Console.

Hope this helps !

Source Link
lrssvt
  • 1.9k
  • 13
  • 10

You have different ways to get what you want by PyQGIS Console:

  1. Aragon's suggestion;
  2. by using QgsGeometryAnalyzer class:
from qgis.utils import iface from qgis.analysis import QgsGeometryAnalyzer mc = iface.mapCanvas() layer = mc.activeLayer() QgsGeometryAnalyzer().buffer(layer, "path_to/output.shp", 500, False, False, -1) 
  1. by using Sextante class:
from sextante.core.Sextante import Sextante Sextante.runalg("ftools:fixeddistancebuffer","input_path.shp", False, 500, 5, True, "output_path_buffer.shp") 

To get the sextante parameters type Sextante.alghelp("ftools:fixeddistancebuffer") in PyQGIS Console.

Hope this helps !