# How to populate M values for an existing x,y,m route layer in ArcGIS 10?

Very surprised to not find this in docs, I swear this was easy in former versions... Whatever, here we go:

Say you have a rivers layer of x,y,m polylines. Each feature is a named river. Each feature was created in the direction of flow, so that the first vertex of each feature is the river's headwater, and the last is its drain (probably where it flows into the next river). I want to assign measures to each vertex of a given feature as the accumulated length of the feature from its drain to that point.

I've only found the 'CreateRoutes' ArcToolbox tool, which not only does the unnecessary work to aggregate features and output a new layer, but it has a wonky idea of 'coordinate priority' to define each feature's measures start point, being that closest to a corner of its bounding box... I want to operate on my layer in-place, and I simply want to start the measures from the start (or end, in my case) of each feature.

One possibility with that tool might be to use its 'TWO_FIELDS' Measure Source, where I use a pair of columns calc'ed with zeros (first column) and feature length (second column)...

I thought I'd check first if anyone else has already been down this path?

-
Does the measure at the TO end of a feature need to equal that of the measure at the FROM end of the coinciding downstream feature? How do you want to handle distributaries ? In other words can you always assume at any point of intersection (node) there is only one features' FROM point present? – Kirk Kuykendall Jul 12 '12 at 22:13
Thanks for your time, Kirk - First, remember I have 1 feature per river - measures do not have to span from one feature to the next. Assuming that measures run in the direction of flow (the opposite of what I want but makes discussion easier) the FROM measure of a feature is zero, its TO measure is its length. At the same x,y location, the FROM measure of the adjacent feature downstream is zero, and increase to its length at its own endpoint, etc. Braided stream areas could get interesting. Now that I've got measures populated, I'll run some tests with events to see what happens. – MC5 Jul 12 '12 at 22:47

If your polyline layer is a river network then the tool RivEX can achieve what you are asking, have a look at this page

-

Yep, that 'possibility' I cited in my last paragraph was (mostly) the ticket. I added fmeas and tmeas columns, calc'ed fmeas = 0, tmeas = shape_length, and used those two columns in the 'CreateRoutes' tool with the 'TWO_FIELDS' Measure Source.

The nonideal thing is that I wanted the measures to run in the opposite direction to flow - be zero at the mouth, max at the headwater - people around here usually think of river miles as increasing upstream from the mouth. But if I do that, the tool flipped the direction of all my features. If I try to edit the feature, using the 'flip' context menu item in the edit sketch, it flips the measures too!

So it appears that measures can only run in the direction of flow?

blah blah somebody stop me...

To fix the issue with the direction of the measurement, try calculating fmeas = shape_length, tmeas = 0 (flip the values)

-
I've never used it, but I wonder if the NHD MValues Utility might be useful for this. – Kirk Kuykendall Jul 12 '12 at 23:46