What is the correct format for finding perimeter as an expression for arcpy. I was able to use expression !shape.Area! to find the area of my polygon. However when I use the expression !shape.Perimeter! I get invalid expression. I've tried the following expressions;




These do not work. I was able to find the perimeter using the attribute table and right clicking and going to calculate geometry. Therefore I know its possible, just I require the syntax for my python code.

My python code that works for area looks like this.


However my python code for perimeter is not working and it looks like this;


I must be missing something, and I've looked at some examples, and have also done, X and Y coordinates, all work, but I cannot get my perimeter to work :(


Try using the word "Length" (i.e. length of polylines, perimeter of polygons) instead of "Perimeter":


I found the geodesicLength property documented in the Calculate Fields examples page:

Geodesic area and length can also be calculated using geodesicArea and geodesicLength properties with @ followed by a unit of measure keyword.

geometries = arcpy.CopyFeatures_management("polygon_fc_name",arcpy.Geometry())
for geo in geometries:
    peri_tot += geo.length

print peri_tot

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • 1
    Please clarify your answer. Note that this question has already an accepted answer, so if your answer doesn't add anything, avoid giving a new answer – Farid Cheraghi Sep 3 '15 at 20:33
  • 1
    @FaridCher We do welcome additional answers to questions even if they have an accepted answer but you are right that this one seems to be trying to suggest an indirect workaround while offering no explanation as to why someone would use it in preference to the previous more direct answer. – PolyGeo Nov 20 '15 at 0:16
  • @PolyGeo , That's for sure. But as i mentioned his answer doesn't add anything to your answer. Thanks – Farid Cheraghi Nov 20 '15 at 0:30

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.