work for rect and poly geometries correctly