laptop and a wrench

Bug

When geometry objects in ArcPy are updated using a cursor, the m-value defaults to 0 instead of null while setting the m-value to null with a cursor causes the edit to be ignored and the value to revert to the original.

Last Published: December 15, 2022 ArcGIS Pro
Bug ID Number BUG-000151375
SubmittedAugust 5, 2022
Last ModifiedJuly 4, 2026
Applies toArcGIS Pro
Version found2.9
Operating SystemWindows OS
Operating System VersionN/A
StatusUnder Consideration

Workaround

Use pt.M = "nan" instead of None and ensure the geometry is M-enabled when recreating it.

def dropMValues(fc):
    spatial_reference = arcpy.Describe(fc).spatialReference

    with arcpy.da.UpdateCursor(fc, "SHAPE@") as rows:
        for row in rows:
            geom = row[0]
            parts = arcpy.Array()
            for part in geom:
                points = arcpy.Array()
                for point in part:
                    point.M = "nan" # math.nan and float("nan") will also work
                    points.append(point)
                parts.append(points)
            row[0] = arcpy.Polyline(parts, spatial_reference, has_m=True)
            rows.updateRow(row)

Steps to Reproduce

Bug ID: BUG-000151375

Software:

  • ArcGIS Pro

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options