In the QGIS properties of a layer I want to activate "draw line only inside polygon" for a specific layer, but using Python. I don't want to use the GUI for it.

Can this be done?

I set the line width with the following code:

props['line_width'] = '1.0'
lineLayer = QgsSymbolLayerV2Registry.instance().symbolLayerMetadata("SimpleLine").createSymbolLayer(props)

Does anyone have any idea how to check the "draw line only inside polygon" checkbox?

Please see attached image. Qgis layer properties

  • This worked props['draw_inside_polygon'] = '1'. – Peter Odd May 31 '16 at 9:49
  • You should consider posting your comment as an answer and then accepting it (which can only be done 2 days after first posting the question) =) – Joseph May 31 '16 at 10:48

To set "Draw line only inside polygon" using python I used

props['draw_inside_polygon'] = '1'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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