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 am looking at features in an ArcSDE geodatabase via ArcMap. The feature shows to have four vertices by viewing the vertices in the map and by looking at the sketch properties.

However if I run a feature vertex to point tool i get 5 vertices. If I get an arcpy.SearchCursor row object and do row.pointCount I get 5 vertices reported.

I even exported the feature class out to a shapefile and got the same results.

Whats going on here? Thanks.

share|improve this question
1  
Isn't the feature a polygon? Then if the polygon ring is closed, you have the first and the last point the same.. –  najuste Sep 19 '12 at 13:26
    
Are these polygons? If so, you may be seeing the start and end point (which are the same) showing up twice. Not in front of ArcMap right now to test, but will in a bit - @najuste beat me to the comment by a few seconds... –  Chad Cooper Sep 19 '12 at 13:27

1 Answer 1

up vote 4 down vote accepted

It sounds like you are working with polygons. I created a 4-corner polygon in a FGDB, and when I look at it in the editor, it does have 4 vertices:

enter image description here

However, when I run the following script on it, you can see it does indeed have 5 vertices (as it should), where the first and last are the same in order to close the polygon:

import arcpy

infc = "NumberOfVertices"
desc = arcpy.Describe(infc)
shapefieldname = desc.ShapeFieldName
rows = arcpy.SearchCursor(infc)
for row in rows:
    feat = row.getValue(shapefieldname)
    print "\tFeature %i:" % row.getValue(desc.OIDFieldName)
    partnum = 0
    for part in feat:
        parts = []
        print "Part %i:" % partnum
        for pnt in feat.getPart(partnum):
            if pnt:
                parts.append([pnt.X, pnt.Y])
            else:
                parts.append(" ")
        partnum += 1 
    print parts  

Part 0:
[[414609.77850000001, 3711987.8151999991], [421594.30240000039, 3711987.8151999991], [421926.89879999962, 3700346.9419999998], [414277.18209999986, 3701178.4329000004], [414609.77850000001, 3711987.8151999991]]

>>> len(parts)
5
>>>
share|improve this answer
1  
Yeah, my guess is the last vertex is hidden to protect the user from accidentally making the geometry invalid. –  blah238 Sep 19 '12 at 17:31
    
@blah238 Very good point. –  Chad Cooper Sep 19 '12 at 18:10

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.