2

Using Python scripting: How can I clip a polygon shapefile with parallel lines (polyline shapefile) to derive new inside polygon?

See image

  • Is orange the polyline and blue the polygon, or the other way around? – Erica Oct 3 '14 at 11:23
  • 1
    Orange is the polygon and blue is the polyline. – Kenn Igben Oct 4 '14 at 4:01
1

Here is how it can be done, but not the actual code to do it. The Feature to Polygon tool would create 3 polygons from the input you have shown in a new feature class. Then you could use a search cursor to process the original input lines layer to select each line separately and process each through a Select by Location operation, with the first using the create new selection option and the second using the select from current selection option. This would select the polygon where both lines touched it. Then you could use a search cursors on the new polygon feature class to read the geometry of the new polygon and an update cursor on the original polygon feature class that selects the original polygon and replaces its shape with the new shape.

Because you have no way of knowing if the removed portions of the polygon will be larger or smaller than the remaining polygon, and the centroid position representing the two irregularly shaped lines cannot be guaranteed to always fall inside of the polygon portion you want to keep, I don't think there is any other reliable process for getting the polygon portion you want to keep.

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.