To clean up a large shapefile, I am looking for a way to do the following:

  • I have the ID of many polygons which need getting rid of stored in a list. These polygons are villages and a second shapefile has the watersheds to each of these, and they overlap.If I delete a village polygon I need the data assigned to it to be appended to the next village downstream. The next village downstream will belong to the next larger overlapping watershed, or the 2nd smallest one to overlap with the original village. The villages and watersheds are linked by an ID number.

  • First step would be: identify the ID of the 2nd smallest entirely overlapping polygon from the watershed shapefile which overlaps with the village identified in the list.

The "Identify" tool looks like it could do the trick but I can't find the script to it, does that exist for Python?

If anyone with experience in python for ArcGIS (ArcMap 10.2 Advanced license) or have tips do let me know!

closed as off-topic by PolyGeo Nov 29 '16 at 1:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I'm not sure I entirely understand the question, but if you've calculated the area of all "villages", then you can spatial join them to the "watersheds" using the "within" match option. Then it's a matter of sorting and deleting the second smallest. Is your question simply, "how to select the second smallest polygon from a group of polygons"? – phloem Sep 24 '14 at 18:39
  • Not quite, I'll try to clarify. It's more that for some villages, the watershed polygon is erroneous, so I'd like to delete that watershed and assign the socio-economic data of the village to the next village downstream. The next village downstream would be the one attached to the next bigger watershed that overlaps with the original village and watershed (ie the second smallest of all overlapping ones). – Fred Sep 24 '14 at 18:46
  • 1
    To clarify this I think it may be better to edit a picture into your question along with the additional words you placed into your comment. – PolyGeo Sep 24 '14 at 22:05
  • 1
    I suspect that the focus of this question should be how "to identify the ID of the 2nd smallest entirely overlapping polygon from a different shapefile which overlaps with the first". If you can clarify just that part in this question then I suspect it will become easy to answer, and then if you are still stuck on any remaining parts they can be researched/asked separately. – PolyGeo Sep 25 '14 at 7:51
  • thanks @PolyGeo , I was having trouble putting words to it. Updating question now. – Fred Sep 25 '14 at 12:58