I have multiple points, and multiple polygons that contain points. I need to match a point to the smallest-area polygon that contains it.
What I get out of the database is a List<(string poly_name, Point point, double area)>
.
So I started by doing list.GroupBy(t=>t.point)
, which gives me a nice IGrouping<Point, (string, Point, double)
.
Now I want to get the smallest area polygon from each group. Linq's Min()
function doesn't allow me to pull the whole tuple; only the smallest area. How can I get the whole tuple?