A constrained k-means clustering algorithm for classifying spatial units