0

I want to write a Python function to create a shapefile layer from clipping an input layer using a mask.

Does someone know the way how to do it?

1
  • 1
    clipping with what? a mask? another shapefile? Current canvas extent? Also please put some effort into it and tell us what you did so far and where you failed.
    – Curlew
    Commented Feb 4, 2014 at 20:07

1 Answer 1

2

import subprocess

subprocess.call(["ogr2ogr", "-f", "ESRI Shapefile", "-clipsrc", mymask, myresult, myinput], shell=True)

The my***s are all shapefiles.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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