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.

I'm using ArcGIS 10 to build some figures for a journal article. One is a figure of an unstructured finite element mesh of triangles spanning the western Atlantic Ocean. I exported this mesh from SMS to a polygon shapefile where each triangle is a polygon and added it to my ArcGIS map. It looks great; however, the islands (such as Haiti and Cuba) are also polygons in the shapefile. I would like to remove them without manually selecting them all.

Is there a way I can select only the polygons with more than 3 sides in order to delete them?

share|improve this question
add comment

3 Answers

In the attribute table, compute a numeric field with the Python expression

!shape.getpart(0).count!

The triangles will all have values of 4 (three vertices plus a duplicate of the first one to close the polygon). The islands almost surely will have more than 4: select them based on this count and delete them, or (more safely) set the layer's definition to include only 4-vertex polygons.

share|improve this answer
1  
That's much more efficient than my solution. So simple. –  Jeff Berry Jan 7 '12 at 0:32
    
Thanks, @Jeff. It's worth noting that yours is more reliable (+1): if there exist multi-part polygons whose first part (.getpart(0)) is a triangle, they will be incorrectly retained. This seems highly unlikely in the present context but future readers will want to be aware of the issue. The problem can be solved with a bit of Python coding in the Field Calculator: you need to check whether all the parts of each feature have four vertices. –  whuber Jan 7 '12 at 0:34
2  
Incidentally, when setting out to answer this question I had no idea what the correct FC expression was, but I knew that ArcGIS had to provide access to the features as lists-of-lists-of-points. A little poking around in the FC help pointed the way, syntactically, and then Googling "arcgis 10 geometry attribute python" quickly turned up ESRI help documenting the "Geometry Object" and suggesting the use of getpart. A couple quick tests with a throwaway shapefile verified that it works. –  whuber Jan 7 '12 at 0:40
add comment

If the triangles are uniform then the areas could be used as a selection criteria. If not, my first inclination would be to do this programmatically. However, you could do this just using geoprocessing tools as follows:

  1. Use the Feature Vertices To Points tool to convert all polygons vertices to a point layer.

  2. Open the attribute table for the resulting point layer, right click on the ORIG_FID field and summarize. This will give you a table with each unique OBJECTID in the original polygon layer along with the count of vertices associated with that feature.

  3. Join the summary table to the original polygon layer based on the OBJECTID in the polygon layer and the ORIG_FID field in the summary table.

  4. Select By Attributes from the the polygon layer where the summarytable.Cnt_ORIG_FID field is > 4. This will select all polygons with greater than 4 vertices. You need to use > 4 to account for the vertex at the start and end of the triangles.

share|improve this answer
add comment

Is your goal to select polygons with more than 3 sides, or just figure out how to excluse your islands? While this doesn't exactly answer how to select a polygon with more than 3 sides, it may get you the result you are after...

Do you have the source polygons for the island layer? If so you could do a "Select By Location" to extract their locations.

If you don't have the actual source of the island polygons, what about using a reasonable facsimile to create a polygon (islands) centroid, then use the centroid to "Select By Location" to find the polygons of your mesh that intersect the centroid points?

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.