get_polygons function.