Skip to main content
fixed code
Source Link
umbe1987
  • 3.8k
  • 3
  • 25
  • 59

I suggest you to give the explode_to_points if the UpdateCursror a try in this case.

If you set it to True, each row of your cursor will be each vertex of your polygons.

I did not tested it, but you can try something like the below:

import arcpy

fc = r"C:\Scratch\fcTest.shp"

# Get Spatial Reference of dataset
desc = arcpy.Describe(fc)
sr = desc.spatialReference

with arcpy.da.UpdateCursor(fc, ["SHAPE@Z"], explode_to_points=True) as cursor:
    for row in cursor:
        if row[0] == 0:
            row[0] = 1.0
        cursor.updateRow(row)

I suggest you to give the explode_to_points if the UpdateCursror a try in this case.

If you set it to True, each row of your cursor will be each vertex of your polygons.

I did not tested it, but you can try something like the below:

import arcpy

fc = r"C:\Scratch\fcTest.shp"

# Get Spatial Reference of dataset
desc = arcpy.Describe(fc)
sr = desc.spatialReference

with arcpy.da.UpdateCursor(fc, ["SHAPE@Z"], explode_to_points=True) as cursor:
    for row in cursor:
        if row[0] == 0:
            row[0]
        cursor.updateRow(row)

I suggest you to give the explode_to_points if the UpdateCursror a try in this case.

If you set it to True, each row of your cursor will be each vertex of your polygons.

I did not tested it, but you can try something like the below:

import arcpy

fc = r"C:\Scratch\fcTest.shp"

# Get Spatial Reference of dataset
desc = arcpy.Describe(fc)
sr = desc.spatialReference

with arcpy.da.UpdateCursor(fc, ["SHAPE@Z"], explode_to_points=True) as cursor:
    for row in cursor:
        if row[0] == 0:
            row[0] = 1.0
        cursor.updateRow(row)
Source Link
umbe1987
  • 3.8k
  • 3
  • 25
  • 59

I suggest you to give the explode_to_points if the UpdateCursror a try in this case.

If you set it to True, each row of your cursor will be each vertex of your polygons.

I did not tested it, but you can try something like the below:

import arcpy

fc = r"C:\Scratch\fcTest.shp"

# Get Spatial Reference of dataset
desc = arcpy.Describe(fc)
sr = desc.spatialReference

with arcpy.da.UpdateCursor(fc, ["SHAPE@Z"], explode_to_points=True) as cursor:
    for row in cursor:
        if row[0] == 0:
            row[0]
        cursor.updateRow(row)