It was then that he met the famous Catalan traveller and spy Domingo Badía y Leblich, more commonly known as Alí Bey, a fellow enthusiast of the Arabic language and botany and the natural sciences.
Badía abandoned Rojas in the north of Africa, but Manuel Godoy paid for his silence with a stipend of 1,500 reales/month for the next four years and commissioned him to carry out a study of the natural history of the former Kingdom of Granada, independently of any academic or administrative authority.
For almost two years he travelled about the Granada, Jeréz de la Frontera and Sanlúcar areas collecting samples of wild and cultivated plants, observing agricultural practices, noting soil characteristics, micro-climates, and the adaptation of the flora to their natural environment.
This book was published as a result of his having met three prestigious agronomists: Esteban, Claudio Boutelou and Francisco Terán, head of the Botanic Gardens of Sanlúcar de Barrameda.
In 1807 he returned to Sanlúcar to run the Botanic Gardens, which he expanded by creating an experimental section with the aim of containing an example of every type of grape vine growing in Spain at the time, along the lines of what Chaptal had proposed in France when he was Minister of the Interior.
According to his first biographer, Miguel Colmeiro, he undertook many scientific and humanitarian projects: he wrote the civil, natural and ecclesiastical history of Titaguas, made topographical drawings of the municipality, researched the genealogy of the local surnames, taught children and adults to classify the different species of birds and plants and created an amateur theatrical company where he himself played a part in Molière’s El Médico a Palos and Calderón’s El alcalde de Zalamea.
After the war he was called on to work on the topographical drawings of the province of Cádiz but he preferred to take the post of Librarian at the Madrid Botanic Gardens, under his friend Mariano Lagasca.