There are high concentrations of urban spaces and increasingly complex land use types. Providing an efficient and scientific identification of building types has become a major challenge in urban architectural planning. This study used an optimized gradient-boosted decision tree algorithm to enhance a decision tree model for building classification. Through supervised classification learning, machine learning training was conducted using a business-type weighted database. We innovatively established a form database to store input items. During parameter optimization, parameters such as the number of nodes, maximum depth, and learning rate were gradually adjusted based on the performance of the verification set to achieve optimal performance on the verification set under the same conditions. Simultaneously, a k-fold cross-validation method was used to avoid overfitting. The model clusters trained in the machine learning training corresponded to various city sizes. By setting the parameters to determine the size of the area of land for a target city, the corresponding classification model could be invoked. The experimental results show that this algorithm has high accuracy in building recognition. Especially in R, S, and U-class buildings, the overall accuracy rate of recognition reaches over 94%.