Least squares association of geometrical features plays an important role in geometrical product specification and verification. Most existing algorithms for the least squares association today usually do not give the covariance matrix associated with the parameters of the respective geometrical feature. The reason is that the complexity of these algorithms can be very high, because partial differential quotients are needed. If the necessary partial difference quotients are calculated by hand and subsequently coded into an algorithm, there is a high risk to introduce unwillingly errors. This paper shows how the least squares algorithm can automatically be generated solely from the equation specifying the distance function of the measured points from the geometrical feature.