5

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 =:**
d
7
  • 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
    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
    Jun 28, 2011 at 14:29
  • I have tried using my old VBA code but it won't work in 10.
    – user3123
    Jun 28, 2011 at 15:05
  • If I put !Shape.MMax! in the codeblock what would I put EndStation equal to?
    – user3123
    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
    Jun 28, 2011 at 15:50

2 Answers 2

4

use field calc to return the MAX M measures:

!Shape.extent.MMax!

use field calc to return the Min M measures:

!Shape.extent.MMin!

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

3

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 that you have read and understand our privacy policy and code of conduct.

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