In Spain, the engineer Agustín de Betancourt developed his own system which was adopted by that state; in 1798 he received a Royal Appointment, and the first stretch of line connecting Madrid and Aranjuez was in operation as of August 1800. Spain was spanned by an extensive semaphore telegraph network in the 1840s and 1850s. The three main semaphore lines radiated from Madrid. The first ran north to Irun on the Atlantic coast at the French border. The second ran west to the Mediterranean, then north along the coast through Barcelona to the French border. The third ran south to Cadiz on the Atlantic coast. These lines served many other Spanish cities, including: Aranjuez, Badajoz, Burgos, Castellon, Ciudad Real, Córdoba, Cuenca, Gerona, Pamplona, San Sebastian, Seville, Tarancon, Taragona, Toledo, Valladolid, Valencia, Vitoria and Zaragoza.