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.

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
add comment

1 Answer 1

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')
QgsMapLayerRegistry.instance().addMapLayer(lyr)
renderer = lyr.rendererV2()
symbol = QgsFillSymbolV2.createSimple({QString('style'): QString('solid'), QString('color'): QString('255,0,0,255'), QString('style_border'):QString('no')})
renderer.setSymbol(symbol)

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

share|improve this answer
add comment

Your Answer

 
discard

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.