I need to calculate the max M value for a line feature using Python in ArcGIS 10 Field Calculator but I cannot figure it out. In 9.3 I used the follow VBA expression…

**Pre-Logic VBA Script Code:**
dim m as imcollection
set m = [shape]
dim d as double 
d = m.mmax

**EndStation =:**
  • You are also able to use VBA in ArcGIS 10 also, if you want too. You just tick the box VBA, instead of Python when in the field calculator.
    – djq
    Commented Jun 28, 2011 at 14:27
  • 2
    With the python parser selected !Shape.extent.XMax! produces the maximum X of a feature extent perhaps !Shape.MMax! might work. sorry I don't have an M-enabled file to check on, but it is worth a shot.
    – user681
    Commented Jun 28, 2011 at 14:29
  • I have tried using my old VBA code but it won't work in 10.
    – user3123
    Commented Jun 28, 2011 at 15:05
  • If I put !Shape.MMax! in the codeblock what would I put EndStation equal to?
    – user3123
    Commented Jun 28, 2011 at 15:12
  • Since I can't try it, check the Python parser, don't toggle on the code block, simply select the field, launch the field calculator and paste in the code snippet. It isn't a function (def) just a field calculator expression, like !shape.area! will calculate area for polygons.
    – user681
    Commented Jun 28, 2011 at 15:50

2 Answers 2


use field calc to return the MAX M measures:


use field calc to return the Min M measures:


you can then calculate the M-length of the line using subtraction.


Use !shape.extent.mmax! to return the max measures for routes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.