Compute and transform centroid location correctly