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
float
values truncate when converted toint
, so you have the option of adding 0.5 first or usinground()