Cerdanya is a comarca in northern Catalonia, Spain, in the Pyrenees, along the border of Catalonia with France and with the principality of Andorra. Within Catalonia, Cerdanya borders Alt Urgell, Berguedà , and Ripollès. The comarca covers the southern half of the historical territory of Cerdanya, divided by the Treaty of the Pyrenees (1659) between France and Spain (Catalonia).