In recent decades, the flora and fauna of cities have become the objects of the interdisciplinary research field of urban ecology and related policies of urban nature conservation. Although the term "urban ecology" is quite recent, it is argued in this paper that the formation of urban nature as an object of ecological knowledge has a much longer history. For example, in Germany, after World War II, the large rubble areas that existed in all bombed cities soon became important research fields for botanists studying plant migration and vegetation development in the context of the city. This paper uses the case of these botanical research activities to shed light on the historical origins of ecological thinking about nature in the city. Drawing upon a socio-spatial approach to science and practice, the paper explores the interaction between the social and material order of the city and the formation of ecological knowledge. As will be shown, botanists studying the rubble areas created various representations (e.g., lists, statistical tabulations, maps) of urban space that contributed to the transformation of the cultural and political meaning of urban wastelands. At the same time, it will be argued, urban wastelands were practically appropriated as scientific workplaces in which these representations were locally crafted. What later became the science and politics of urban ecology is to a large extent the outcome of this mutual shaping of knowledge and urban space in the post-Second World War period.