The design of district heating systems often involves the consideration of the appropriate system scope, referred to as spatial scale. In order to achieve climate-neutral heating in neighborhoods, it is necessary to address spatial scale in the early planning stages. This study presents a novel optimization method aimed at sustainable dimensioning of the district heating system by optimizing the system type, scope, and equipment simultaneously. The method quantifies the spatial scale of targeted district heating system and assists in the decision between decentralized and centralized systems by using clustering algorithms and the genetic algorithm. The proposed approach was rigorously tested in a city-scale case study against centralized pipe network and standalone approaches. Our findings reveal that the proposed methodology outperforms traditional threshold methods and fixed-scope optimization through a three-group comparative study, culminating in a globally optimal solution for district heating systems.. Finally, the study offers insights into the intricate interplay between energy systems and district heating network scopes, underscoring the pivotal role of spatial scale considerations in the design of district heating systems toward climate-neutral paradigms.