IN THE 1940s Jorge Luis Borges, an Argentine writer, wrote a short story about mapping. It imagines an empire which surveys itself in such exhaustive detail that when unfolded, the perfectly complete 1:1 paper map covers the entire kingdom. Because it is unwieldy and thus largely useless, subsequent generations allow it to decay into tatters. Great scraps are left carpeting the deserts.

In their capacity for up-to-the-minute detail, modern maps surpass even Borges’s creation. By using networks of sensors, computing power and data-crunching expertise, digital cartographers can produce what are in effect real-time simulations of the physical world, on which both humans and machines can base decisions. These maps show where roadworks are blocking traffic or which street corners are the most polluted. Innovative products will make new demands of them. Drones need to know how to fly through cities; an augmented-reality game might need to know the exact position in London of Nelson’s column.

Google is the giant of the consumer-mapping world. More than 1bn people use the Google Maps smartphone app every month. Rivals can still prosper by providing detailed directions in dense cities: CityMapper, for example, tells its users which exit to take in London’s warren-like tube stations. But none can match Google’s revenues. Local search ads allow firms to place adverts inside the search results of a person who is physically near their premises, along with maps showing their locations. And promoted pins permit businesses to highlight their own positions along routes that Google calculates for navigation—a pin for a Starbucks en route to Central Park in New York, say. Morgan Stanley, an investment bank, projects that such ads will generate $1.4bn of revenue for Google in 2017, rising to $3.3bn by 2020.

Yet the race to develop autonomous cars, which cannot run without guidance from machine-readable maps known as “splines” or “digital rails”, could be a far bigger opportunity. Goldman Sachs, another investment bank, reckons that the market for maps for autonomous cars will grow in value from around $2.2bn in 2020 to $24.5bn by 2050 (see chart). Google’s dominance in consumer mapping means it has a strong advantage in this emerging field (which will mainly accrue to Waymo, its autonomous-car spin-off). But it will not have things all its own way. An assortment of other Silicon Valley giants, startups, carmakers and a few old-fashioned mapping firms, are fighting hard. The inputs for digital mapping are threefold. First comes information about roads, buildings and so on. Such base maps have been commoditised. A British open-data repository called OpenStreetMap (and its cousin organisation, OpenAddresses), that is already widely used and has global data, provides the basics. Many new mapping businesses build on top of OSM data. Imagery containing close-up detail of streets is the second main ingredient. In May Google said it had used an artificial-intelligence technique known as deep learning to scan 80bn photos, automatically identifying house numbers and the names of streets and businesses. Its photos were gathered from its “StreetView” cars, which have trawled the planet capturing street imagery since 2007, at a vast cost. This archive is a barrier to entry for other companies, but it may be tumbling. Mapillary, a Swedish startup which also uses deep learning to process imagery, has released a data-set of 25,000 street photos collected through its own sensor network. Its chief executive, Jan Erik Solem, says that Mapillary’s fastest-growing business is providing data mined from those images to companies that are trying to build maps for autonomous cars. (Laser scanners and radar used by autonomous cars to navigate will add to the torrents of data.)

Large quantities of real-time GPS location data from people with smartphones in their pockets are the third important input. Google harvests such data from Google Map users as they move around the world. If it stops seeing data streaming off a street, for example, it is likely to mean that the road has been closed. Here, too, Google’s defences are looking less impassable. Mapbox, a young firm based in San Francisco, has found another clever way to compete—a map-specific software-development kit (SDK) which any developer can install and use to present maps to users. When those users call up one of its maps, Mapbox receives anonymised location data. Mapbox’s SDK is now in some 250m phones. Marc Prioleau, a mapping guru whom Mapbox poached from Uber, a ride-hailing firm, says the firm is gathering enough data in the Bay Area alone to redraw every road there ten times a day.

Google is also vying with a legacy mapping firm that has sold map data for car-navigation systems since 1985. Germany’s three largest car companies, Daimler, Volkswagen and BMW, bought HERE, based in Chicago, for €2.8bn ($3.1bn) in 2015. In December a Chinese and Singaporean consortium including Tencent, an internet giant, and NavInfo, a mapping firm based in Beijing, took a 10% stake in it. HERE will provide Tencent with digital maps of China. It will get access to location data from WeChat, Tencent’s popular chat app, connecting it to a sensor network the scale of which rivals Google’s. The firm has also joined forces with Shenzhen-based DJI, the world’s biggest drone-maker.

America’s big three car companies, General Motors, Ford and Fiat Chrysler, have also invested heavily in digital mapping through AI startups and in partnerships with ride-hailing firms and with TomTom of the Netherlands, another older mapping firm. Google is hard to avoid, though: Fiat Chrysler has joined Waymo’s self-driving programme in Phoenix, Arizona and will use the search giant’s mapping data. And whoever ends up winning most sway over cartography, Borges’s everything map is no longer imaginary.