The reasonable spatial planning of primary and secondary schools is an important factor in education development. In spatial planning, there are many models for the locations of primary and secondary schools; however, few quantitative evaluation models are available. Therefore, based on the many factors affecting the layout planning of primary and secondary schools, a knowledge graph of territorial spatial planning that considers the topological relationship, direction relationship and metric relationship in spatial planning is designed and constructed. A school location evaluation model based on the knowledge graph of territorial spatial planning is proposed. The model combines many factors of the locations of schools, such as the service population, the impact of factories on schools, the adjacency and centrality of school plots, terrain and existing schools in the region, to quantitatively evaluate whether schools are reasonably located within a region. This study focuses on the Guangyang Island area in Chongqing, China, exploring the superiority and rationality of the planned land use for primary and secondary schools within the region. By analyzing the top three and bottom three ranked schools in conjunction with the actual conditions of the site, and comparing them with AHP hierarchical analysis and ArcGIS modelling research, the study concludes that the results of this model are highly reasonable within the scope of China’s territorial spatial planning.