Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

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

From Python console I load a shapefile with qgis.utils.iface.addVectorLayer. How I can remove border lines (change to no pen) in the active layer?

share|improve this question

This assumes you are using the new symbology renderer (which is the default):

from PyQt4.QtCore import *    
lyr = QgsVectorLayer('/data/world_borders.shp', 'world_borders', 'ogr')
renderer = lyr.rendererV2()
symbol = QgsFillSymbolV2.createSimple({QString('style'): QString('solid'), QString('color'): QString('255,0,0,255'), QString('style_border'):QString('no')})

Then trigger a repaint for the layer and update the legend.

share|improve this answer

Your Answer


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

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