laptop and a wrench

Bogue

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.

Dernière publication: December 15, 2022 ArcGIS Pro
Numéro d’ID de bogue BUG-000151375
EnvoiAugust 5, 2022
Dernière modificationJuly 4, 2026
S’applique àArcGIS Pro
Version trouvée2.9
Système d’exploitationWindows OS
Version du système d’exploitationN/A
StatutUnder Consideration

Solution de contournement

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)

Étapes pour reproduire

ID de bogue: BUG-000151375

Logiciel:

  • ArcGIS Pro

Recevoir une notification lorsque le statut d’un bogue change

Télécharger l’application Esri Support

En savoir plus sur ce sujet

Obtenir de l’aide auprès des experts ArcGIS

Contacter le support technique

Télécharger l’application Esri Support

Accéder aux options de téléchargement