getMidpoints function

Compute midpoints across grouped coordinates