Calculated measurements were lost in polylineM shapefile

Solution or Workaround


When converting Intergraph MGE data to polyline shapefile and then to a polylineM shapefile, in order to do dynamic segmentation, all the calculated measurements were lost in the resulting polylineM shapefile. All the measurements had to be recalculated for the dynamic segmentation to work.


When ArcView converts polyline shapefiles to polylineM shapefiles, the measurements are not retained.


There are two ways to resolve this:

· Use the sample script that converts polyline shapefiles to polylineM shapefiles. You will need to add a line to calculate measurements.

1. Open the example on the Help topic 'PolylineM (class).'

2. Copy the script into a new script window.

3. Find the following code segments:

For each rec in theFtab
theShape = theFtab.ReturnValue(theShapeField,rec)
theShapeM = theShape.AsPolyLineM

'Get the attributes back ...

theNewRecnum = theNewFtab.AddRecord

5. Insert the following code between those segments:

' Calculate the measures for each feature in map units

6. Compile and run the script on your data.

· The previous method of calculating measurements may not be accurate enough. For more precise measurements, you will need to calculate each line's measurements individually. In order to do this, you need to run the InterpolateMBetween request on
each individual feature needing a measurement. To do this, you need to go into the shape properties of a polylineM feature and edit the first and last m values. For example, you know the distance between the first vertix and last vertix is 100, you would edit the first m value as 0 and the last as 100.

1. In the attribute table, click the shape field.

2. Click the field calculator, and type the following:


Where n is the number of vertices in the feature.

This will calculate the measurements between vertices for each feature.

3. Run the calculation run on each feature in the table.

In order to edit a polylineM file, you need to place a customized default.apr in the working directory to allow you to make edits to this feature type.

To customize a default.apr do this:

1. Make a backup copy of the View.ToggleEditingUpdate system script.

2. Add the following line to the View.ToggleEditingUpdate script:

or (clsName = "PolylineM")

3. Save the script.
4. Make the script default and store in the $HOME directory.

Article ID:000001562

  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic