Sign up ×
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 ArcMap 10.0 and am trying to get the length of a polyline by adding a field to the attributes table and calculating geometry, but that option is grayed out. Someone suggested that it's because my map was in degrees but according to the properties for the data frame, both display and map units are in meters, which means I should be able to get the lengths of these lines, right?

share|improve this question
Are you trying to do this with a shapefile or geodatabase? – Rayner Sep 27 '12 at 14:00

3 Answers 3

I met the same problem. But I had my data projected, so this was not the problem. If the calculate geometry and field calculator are grayed and the feature classes are in GDB - start Editing in Editor tools, if this doesn´t help try to delete geodatabase lock in Windows explorer and restart ArcGIS a PC for sure.

share|improve this answer

Your data is probably not projected. This means that inside the shapefile, the vertices of your polyline are stored as decimal degrees. Usually, you would have to use the Project tool to project the dataset into a planar spatial reference system that allows for geometric calculations in non-angular units. However, when calculating line length (but not area), ArcGIS can calculate the geodesic distance, which should result in an even more accurate result.

So instead of using the "Calculate geometry" tool, use Field calculator, select the "Python" parser, and enter the following expression:

share|improve this answer
dmahr: Thank you for the advice. You and David are correct: my data are not projected. I tried !shape.length@meters! and if that is literally what I'm supposed to enter (the new field is called 'length') I get a 'failure during processing, check the geoprocessing results window for details. That brings up a the Calculate Field table where I'm guessing I'm being invited to correct the expression? Or change the expression type? I also tried the Define Projection tool to change the object's spatial reference NAD 1983, but neither calculate geometry or !shape.length@meters! works on that. – Steve Sep 11 '12 at 20:17
Define projection only changed the metadata, not the actual coordinate values. Try defining the coordinate system back, then using the Project Tool or set the data frame's coordinate system to an appropriate projected coordsys. – mkennedy Sep 11 '12 at 20:41
@Steve Make sure that when you are using the field calculator, you are using the "Python" parser. Also, ensure the that "length" attribute's type is "double" and not "short" or "long. " – dmahr Sep 11 '12 at 21:47
@dmahr, It looked more promising, as the error message wasn't immediate. But again there was an error in the geoprocessing which just brought up the calculate field tool. I tried python and python 9.3 with the same result. Just to be sure, the Input Table is the costpath, the field name is length, the expression is !shape.length@meters!, the expression type is phython, and the code block is empty. Thanks! – Steve Sep 12 '12 at 15:29
What does the error message say? – dmahr Sep 12 '12 at 16:25

See "Reasons the Field Calculator might be Disabled" in the bottom half of Fundamentals of field calculations.

share|improve this answer
Kevin: Thank you for the link. You and dmahr correctly guessed that my data are not projected. That hasn't solved it however.... (see comments to dmahr's post). – Steve Sep 11 '12 at 20:01

Your Answer


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.