On a street near the center of Lund, Sweden, the city will soon start installing the first real-life demonstration of a new type of electric road. Running down a kilometer-long stretch of a bus lane, an electric rail will connect with an attachment that can be built into any electric vehicle, making it possible to charge the battery while driving.

“This started eight years ago when I wanted to buy an electric car, and I thought the range was too short,” says Dan Zethraeus, CEO and founder of Elonroad, the company that developed the technology. (The name, they say, has no relation to Elon Musk.) The range of electric cars keeps improving–many cars can now drive more than 200 miles before they need to plug in. Still, there are reasons why it still might make sense to avoid traditional chargers.

One reason is the battery itself: If cars, trucks, and buses can power up as they drive, batteries can be smaller. That would mean mining less lithium and other materials in a process that can pollute the environment, as has happened in Tibetan villages in China where a river was poisoned by a nearby mine. “The less material we use for batteries, the better,” he says. Along with researchers from Lund University, the startup has estimated that an electric road infrastructure would make it possible for batteries to be 80% smaller.

Smaller batteries would also make electric vehicles cheaper, since the battery is the most expensive part of the vehicle. Battery costs are already dropping–by one estimate, owning an electric car will be as cheap as a fossil-powered car by 2022. But shrinking the battery would amplify that effect.

Electric roads, or the same technology in parking lots, could also work seamlessly with autonomous vehicles that can’t easily plug themselves into chargers. On highways, they could help power electric semi trucks that could otherwise take too long to charge. In crowded cities, they could eliminate the need for charging stations to take up space and make it easier for people without driveways to own electric cars. That’s especially true in China and India, Zethraeus says. “They don’t have the space to have cars standing still and charging.”

The switch to this type of infrastructure would be a massive undertaking, of course. They’d need to be connected to power lines. But the company argues that the rails themselves are relatively easy to install, since instead of replacing a road, they can be added on top of asphalt. They also don’t need to be installed on every road, since a car or truck can charge up on a main road and then use the electricity stored in the battery to go farther. “If [a car] drives one kilometer on our electric road, it can drive another two kilometers on the energy it charged from our road,” he says. “So it makes a total of three kilometers of driving. But you only pay for one kilometer of [installation].” In Lund, the company has calculated that all of the city buses could operate if only the main road was electrified, since all of the buses take that route. And unlike some other approaches–like overhead wires that can charge buses or trucks–the rails on the road could work with any vehicle that has an attachment to contact the rail and activate it.

The city will start building the first section of the demonstration road in 2020.