What is the shape of the earth? For centuries people knew the planet was essentially spherical, but by the 18th century debate began to rage over whether it might bulge at the equator or be somewhat elongated at the poles. Did the Earth, in effect, resemble an exercise ball when someone sits on it, or does the planet look like an egg standing upright in its carton?

The latter was the more widespread view, ultimately derived from Descartes, but Isaac Newton had recently argued for a bulging equator, since it played into his newfangled theories about gravitation. On the surface, so to speak, the resulting controversy may seem trivial or even nationalistic, just one more of those heated quarrels among philosophers and scientists over an apparently trifling matter. Yet without knowing “the figure of the Earth” one couldn’t reliably determine geographical location. Navies couldn’t navigate with precision, land surveyors would be a bit off in their calculations, explorers might go astray.

To resolve matters, the French and Spanish joined forces in what Larrie D. Ferreiro describes in “Measure of the Earth” as the first cooperative international scientific expedition. A team, sympathetic to Newton’s view, would travel to what is now Ecuador and measure the exact length of a degree of latitude near the equator. This would then be compared with the same measurement taken in France. If the latter was larger, Newton was right.

The 1735 Geodesic Mission to the Equator mainly consisted of a trio of mismatched French scientists and a pair of efficiently practical Spanish naval officers. It is a wonder that the enterprise ever succeeded. Gathering together everything that can be known about the mission, Ferreiro reveals, yet again, how much the objective ideals of science may be practiced by very flawed human beings. To start, a project that on paper should have required at most three years ended up taking nearly a decade.

The overall mission leader, the ambitious Louis Godin, lacked every management skill: He was arrogant and absolutist, kept crucial information to himself, spent government money with abandon (a good deal of it on a prostitute with whom he’d grown infatuated), and generally alienated everyone with whom he worked. Charles-Marie de La Condamine, by contrast, was a worldly and wealthy friend of Voltaire, as much an adventurer as a scientist and one of those men whose actions regularly combined “curiosity, bravery, and sheer idiocy.” Pierre Bouguer, who had not really wanted to join the expedition, eventually became its de facto chief, ousting Godin. Bouguer’s book, “The Figure of the Earth,” later became the standard scientific account of the Geodesic survey.

‘Measure of the Earth: The Enlightenment Expedition That Reshaped Our World’ by Larrie D. Ferreiro. Basic Books. 353 pp. $28. (Basic Books)

After months of difficulties and delays on the island of Saint Domingue, the French group was joined by two Spanish naval officers: Jorge Juan y Santacilia and Antonio de Ulloa y de la Torre-Guiral. Ferreiro clearly admires these young men for their quiet professionalism. They were capable engineers, expert swordsmen, deeply sympathetic to the native peoples and openly outraged by colonial atrocities. The two friends would eventually go on to distinguished maritime and diplomatic careers, and are still venerated by the Spanish navy: “From 1851 until the modern day, three pairs of warships have borne their names.”

Eventually, the full team reached its destination, the city of Quito. Following further squabbles and reversals, the scientists, along with their servants and slaves, finally began their measurements. They first created a baseline, “an absolutely straight path, seven miles long and just eighteen inches wide.” Then, on the slopes of the nearby mountains and volcanoes of the Andes, they erected “large pyramids of timber, straw, and fabric, whitewashed with lime and lye, to make signals that could be clearly seen through a telescope, even at thirty miles’ distance.” Using these pyramids — and sometimes just their large tents — as focal points, they gradually calculated the dimensions of a chain of gigantic interlocking triangles running south along the Andes. This triangulation extended a little over 200 miles to the city of Cuenca.

Nothing went smoothly. Frequent cloud cover impaired accuracy during key sightings. The group suffered from altitude sickness, dysentery and malaria (the latter cured by quinine from the cinchona tree, which the scientists studied), hostile colonial administrators, lack of funding and internal strife. At one point, a riot erupted at a Cuenca bullfight, and the expedition’s surgeon, Jean Seniergues, was beaten and stabbed, dying of his wounds. After war broke out between England and Spain, and British naval forces ravaged the nearby seaports, Ulloa and Santacilia were ordered to provide military leadership and assistance. Despite such complications, the team eventually completed its setup and, using an instrument called a sector, made a series of simultaneous celestial observations and calculations. These determined that the length of a degree of latitude at the equator was 68.7 miles. This, notes Ferreiro, is “within fifty yards of the modern accepted value.” The result proved that “the length of a degree of latitude shortened considerably toward the equator, as a result of its bulging out from the axis. Bouguer and La Condamine had confirmed that the planet was indeed oblate and that Newton was right.”

When the pair eventually returned to France, both were feted by their scientific colleagues. La Condamine’s action-packed “Abridged Relation of a Voyage Made in the Interior of South America” soon became an international bestseller. But Godin, who knew he had wrecked his career, stayed behind, partly redeeming himself when, after a huge earthquake, he oversaw the reconstruction of Lima into “one of the most gracious cities in South America.”

In “Measure of the Earth,” Ferreiro has produced an astonishingly detailed account of the Geodesic Mission and its importance. He has mined all the sources, visited the key sites, balanced conflicting historical documents and memoirs, and produced a book that is gripping, authoritative and fair. In particular, Ferreiro reminds us that this expedition — despite the frequent foolishness and ineptitude of its members — became one of the great scientific adventure stories of the 18th and early 19th centuries. Moreover, it “inaugurated a spate of large-scale international scientific expeditions that rewrote our understanding of the planet, and it gave us the concept of South America as a unique place, separate from its mother country of Spain, which would eventually give birth to the new nations of Latin America.” The memory of the mission also spurred a young naturalist named Charles Darwin to undertake his own voyage to the equator, with notable consequences.

Above all, though, “Measure of the Earth” reminds us that scientific research requires luck, perseverance and cash as much as genius and vision, that scientists are often all too human, and that groundbreaking discoveries are soon superseded, forgotten or taken for granted. If you enjoy reading popular histories of science — such as Dava Sobel’s “Longitude” or Jonathan Weiner’s “The Beak of the Finch” — you should certainly add Ferreiro’s “Measure of the Earth” to this tropical summer’s reading list.

Dirda reviews books for The Post every Thursday. Join his discussion at wapo.st/reading-room.