I am iterating to get extents (XMin, XMax, YMin, YMax) of each feature (1 deg x 1 deg polygons). The values of the extents parameters are double precision and display to one decimal place. I need to remove the decimal, so I am converting to integer. However, integer is rounding negative extents up one degree. How would I get the values without decimals and not change?

    with arcpy.da.UpdateCursor(layer1x1,['GEOCELL', 'SHAPE@']) as cursor:
       for row in cursor:
          extent = row[1].extent
           print (extent.YMin), (extent.XMin), (extent.YMax), (extent.XMax)

-46.0 -90.0 -45.0 -89.0

        print int(extent.YMin), int(extent.XMin), int(extent.YMax), int(extent.XMax)

-45 -89 -44 -88

  • 1
    This is more of a pure Python question, better researched over in Stack Overflow. Hint: float values truncate when converted to int, so you have the option of adding 0.5 first or using round()
    – Vince
    May 8 at 12:33

1 Answer 1


Rounding before integer worked.

print int(round(extent.YMin)), int(round(extent.XMin)), int(round(extent.YMax)), int(round(extent.XMax))

-46 -90 -45 -89

Not the answer you're looking for? Browse other questions tagged or ask your own question.