When I use shapely to find a centroid, it gets me fractional values, even if I set the precision:
bbox = shapely.Polygon(coords)
shapely.set_precision(bbox, grid_size=1)
centroid = bbox.centroid
print(f'{centroid}')
# POINT (1125 1348.5)
How can I tell Shapely to snap the centroid to a grid? In this case, I'd like each dim of the point rounded to the nearest integer.
Use
set_precisionon the centroid: