Portobello is wistfully touted as "Edinburgh's seaside". Close up, it's a mile-long stretch of urban beach flanked by a coal-fired power station on one side, and a leaky sewage works on the other. The seaside town grew from an eighteenth-century brickworks called Figgate Muir, and, though Portobello has been transformed, its industrial legacy still silently smoulders.

But stroll along the central prom, past a couple of lurid amusement arcades, a modern eyesore block of flats and a traditional Victorian bath house, and you'll find the linear beachscape has also just radically changed.

Glaswegian artist Hill Jephson Robb has just hand-built three pyramids on the central section of Portobello beach.

They look raw, majestic and mesmerising. The largest is almost four and a half metres high. Jephson Robb calls his project "Wonder".

He has built these pyramids using sublimely basic materials: 10,000 biodegradable hessian sandbags filled with local sand, layered and stacked like brickwork, in deliberate homage to Portobello's industrial roots.

I perched on a couple of spare sandbags and talked to Jephson as he shifted and stacked the last pile. He was being assisted by a swath of local volunteers who've turned up every day for the past month to help him out.

"This project wasn't originally about pyramids at all," he says.

"It's a public-art commission to revitalise and transform Portobello beach. I thought about the first impression a visitor has of this beach: they see a flat seascape, surrounded and defined by its boundaries. I wanted to break through the boundaries and transform the local landscape as radically as I could. So, I read up on Portobello's local history to see where the town came from and what the people here want from their community in the future."

Portobello seaside resort emerged from the expansion of the Figgate Muir brickworks, and was renowned for its ambitious local architecture, which included the marine gardens, the pier and the Victorian bathing machines that allowed ladies to undress discreetly.

These architectural features have crumbled, though many of the sea-front houses are still perfectly intact, and Portobello remains a distinct and vibrant East Lothian community. Almost two years ago, local activists beat back developers who were intent on building a giant supermarket at the edge of the town. Jephson Robb describes the campaign against the supermarket as a turning point for the entire community.

"The way I see it, Portobello's past is represented by its architecture, and the present by this local victory against outside commercial interests. When it came to visualising the future here, I wanted this project to represent limitless possibilities."

He examined the physical boundaries of Portobello, and its natural geography: pondering where the town actually begins and ends, and the limits imposed by the beach, the sea and the horizon.

"It was a total leap of faith to build pyramids in the middle of the beach," he says. "Pyramids are iconic and expansive. These three represent Portobello's past, present and future. I've used 10,000 sandbags: one per local household, and I advertised for locals to pop down to the beach and fill a sandbag. This project was commissioned by local people and as soon as it's finished, it belongs to them."

Wonder was commissioned by a Portobello public art project - Big Things on the Beach. Its remit is to commission temporary public art in Portobello for both locals and visitors. Caroline Muirhead is the project development worker.

"Big Things on the Beach has been going since 2004, and this is our third annual commission" she says. "It's certainly the most ambitious project so far - and the local response has been brilliant. People really wanted to get involved."

Portobello residents have been on the beach in droves, filling sandbags and helping Jephson lug them over to the pyramids.

Such enthusiasm has also helped prevent the pyramids being trashed by vandals.

"There has been sporadic vandalism," says Jephson. "I've been putting in 12 hours most days this month, and it's disheartening when people make such an effort to wreck what's essentially theirs anyway. But most people just want to be part of it, and they're having fun. At four o'clock every day this site has become a local outdoor creche."

Jephson is obviously proud of his creation, and gives a shrewd running commentary while shifting the sand bags. "I think it works because it's a local project with a global reference, and yet it's not exclusively for local residents. One of the aims in fact, is that other people will come here to see the pyramids, and by doing so they'll visit a beach without taking an aeroplane, and see one of the wonders of the world without travelling to Egypt."

After their inauguration, the pyramids will be left to deteriorate naturally for six months, as a reflection of human impact on the environment. At the end of the year they will be dismantled, the sacks removed and the sand trampled back down.

Public art evolved from architecture, and some art historians argue that architecture is the original public art. Statues and war memorials came later, followed by political and religious public-art propaganda. The Bolsheviks were brilliant public-art curators throughout the Russian Civil War, and Chinese public-art propaganda is also in a league of its own.

The Greek artist Nonda kick-started a modern public-art revival when he built a Trojan horse under Paris's Pont Neuf in 1963. Two decades later, the collaborative duo Christo and Jeanne Claude audaciously wrapped Berlin's Reichstag in white fabric. Meanwhile, Antony Gormley's metal casts of his own body have evolved into a British public-art staple.

Wonder works on many levels: it is visually arresting, interactive, local yet global, historical yet entirely modern. Jephson is adamant that, unlike many other public-art projects, his is not an attempt to galvanise the local community. Portobello is already a thriving community in its own right. I can testify to that because I live here.

Portobello beach is a centre-point of the local community. One of the death knells of other urban communities across Scotland and Britain is a lack of indoor or outdoor communal public space. As Naomi Klein pointed out in her seminal book, No Logo, corporate branding of public space has wrecked communities. Community centres have become supermarkets, and play parks have been tarmaced into car parks. People need communal space to meet and make friends and be creative. So, Wonder has simply tapped into Portobello's most precious natural resource.

Jephson Robb's previous work includes a womb-like purple felt sphere made from 40kg of wool, which is now in the New York Museum of Modern Art's permanent collection. He made it for his niece who lost her mother when she was seven months old. He described the process of soaking, drying and rolling the wool as a physical expression of personal grief.

At last year's Pittenweem arts festival he laid a seven-metre circle of 23-carat gold leaf onto the ground at the end of the old harbour. I asked him what the locals did to or with this circle of pure gold.

"Some people scraped at it and did wheelies on their bikes over it," he says. "But others, they carved messages of love and kindness into the gold. It's theirs to do what they want with. Just like these pyramids. Personally, I hope people climb on top and stargaze."

  • Wonder opens at Portobello beach today at 4pm and will remain there until December 21.