Fix #9951 (perimeter completely wrong with OTF on)

With OTF on and computation on an ellipsoid, the coordinates
were transformed twice(!) when measuring perimeter.