Government agencies across the country are sitting on gigabytes of valuable digital data that could be mashed, mixed and re-organized in crafty ways by Web 2.0 entrepreneurs and public interest groups engaged in everything from government oversight, to providing practical information to Americans.

Yet, despite federal and state public records laws designed to make the data accessible, many agencies are fighting more ferociously than ever to keep data created with public funds out of public hands. In their battles to withhold information, bureaucrats are citing everything from copyright and trade secret privileges to privacy and national security concerns. And when they do provide data, some agencies charge exorbitant prices for it, ensuring it's only available to those with deep pockets.

As the country observes Sunshine Week, there are many reasons to be optimistic, public records advocates say, particularly in the wake of President Barack Obama's pledge to digitize federal records and open them to the public. But with lawmakers and judges too often siding with agencies that resist data disclosure, there remain more reasons to be concerned.

"We stand on the edge of being able to truly democratize data in ways that we've never been able to before," says Charles Davis, executive director of the National Freedom of Information Coalition. "And yet, at the same time, we face probably more irrational opposition than ever before to releasing data."

A case decided last month in California illustrates the lengths to which governments will go to hold onto taxpayer-funded data. In 2006, the California First Amendment Coalition used the state's sunshine law to ask for a digital, data-rich map compiled by Santa Clara County. Called a geographic information system, or GIS, parcel basemap database, the map shows the boundaries of 450,000 real estate parcels in Silicon Valley, along with overlaid aerial photos, street addresses and other data.

In response, the county demanded $250,000 for the information, along with a signed non-disclosure agreement asserting that CFAC wouldn't redistribute it.

When CFAC balked — why should public information come with an NDA and a six-figure price tag? — the county resorted to a mishmash of arguments to keep the information secret, claiming first that the data was copyrighted, and then that its release would harm Santa Clara County's "national security." Last month, after more than two years of litigation, a California appeals court ordered the data released, offering a glimmer of hope to open-government advocates.

"Other states can still say, 'Screw you,' and ignore the California ruling," says Peter Scheer, CFAC's executive director. "But it is a published opinion by a court that is held in some regard, particularly on technology issues." [Disclosure: Wired.com's editor in chief is a CFAC advisory board member.]

The tension between record seekers — including journalists and nonprofits — and government agencies often stems from the fact that bureaucrats collect data to do their job; while the public often requests it to prove otherwise. "Government does not want to release the data, because people would draw ... conclusions that government doesn't want them to draw," says Bill Allison, senior fellow with the Sunlight Foundation.

Adding to that resistance are more reasonable privacy concerns. In addition to a handful of cases where genuinely private information like Social Security numbers were mistakenly released, the internet is making public data feel private to those who find themselves exposed in new ways.

For example, when California's Proposition 8 passed last November banning gay marriage, an opponent of the measure created a website to expose donors who financed the ban. The site culled donor names, ZIP codes and, in some cases, employer names, from data the state collects under campaign finance disclosure laws. Then it combined that data with Google Maps to show donors' approximate locations, and in some cases identify their employers. Gay marriage opponents were appalled and complained that they received harassment and death threats.

"For years we've had campaign finance disclosure," Allison says. "But nobody thought this information would wind up on a Google map."

The federal FOIA includes an exemption for records involving private citizens, but agencies and courts sometimes take that exemption to an extreme, Davis says.

In 2006, the nonprofit Center for the Study of Services sought information about Medicare claims for its Consumers' Checkbook website. The center wanted anonymous information about patient diagnoses, along with the physicians' identifying number, the procedures performed and amounts billed to Medicare. The aim was to help match patients to experienced doctors for specific procedures, and determine if practitioners were over-billing Medicare or receiving government funds for high-risk procedures they didn't have the experience to perform.

But the Department of Health and Human Services denied the request on grounds that it violated doctor privacy by disclosing physician incomes. In a ruling applauded by the American Medical Association, last month a federal appeals court sided with the department. The court concluded that releasing the data didn't serve a public interest, because FOIA was meant to provide oversight of government agencies, not private businesses like medical practices.

In another case in 2000, an Illinois reporter sought the names and offenses of federal prisoners held in a county jail under a rent-a-jail program designed to alleviate crowding in federal prisons. The reporter wanted to know if high-security criminals were being housed in the county's low-security jail. But a federal district judge ruled against her on privacy and security grounds, saying that naming prisoners would "stigmatize" them and "cause irreparable damage to their reputations," because some of them were detainees or witnesses who hadn't been charged with crimes. The case was upheld on appeal.

At the root of these anti-disclosure rulings is a 1989 Supreme Court case that pitted the Reporters Committee for Freedom of the Press against the Justice Department. The RCFP sought the rap sheet for a businessman suspected of mob ties and an improper relationship with a congressman. Much of the information was already accessible in bits and pieces in various public records, but the reporters wanted the data as it was compiled in the FBI's NCIC database. The Supreme Court unanimously held that adding computers to the mix made the privacy risks greater.

"Plainly there is a vast difference between the public records that might be found after a diligent search of courthouse files, county archives and local police stations throughout the country and a computerized summary located in a single clearinghouse of information," wrote Justice John Paul Stevens for the court.

Significantly, the court also concluded that the purpose of FOIA was to monitor the government, not private citizens. Rarely would records involving private citizens aid in keeping an eye on government activities, the court said.

"It's absolutely illogical on its face to assert that," Davis says. "And yet it's the standing legal position of the U.S., and the Department of Justice has defended that for years."

As a result, Davis says, it's inordinately hard to get access to public records that might prove government wrongdoing when privacy exemptions protect a private citizen mentioned in the file. That is, unless there's already proof of the wrongdoing before the records are sought.

"Then you might be able to overcome the privacy protection," Davis says. "If you have proof of the conspiracy, then we'll give you access to the records that might prove your conspiracy."

One troubling trend with the digitization of data, experts say, involves agencies that give data to a private party to build technical architectures around it, and in the process relinquish control of the data.

"That's what happened in 2003, when the General Services Administration contracted with a private company named Global Computer Enterprises to build a searchable database of contracts collected from all federal agencies. A GCE competitor named Eagle Eye filed a FOIA request with the GSA to obtain the bulk data. For 15 years, Eagle Eye had been obtaining the information from the GSA. But this time, the GSA balked, claiming GCE now controlled the data.

Eagle Eye eventually won an administrative FOIA appeal arguing that GCE didn't own the data, but was simply a contractor. But by then it was out $15,000 in legal fees.

Davis says allowing a contractor to decide FOIA requests is wrong and says situations like this will only get worse, "unless we get extraordinarily clear about the fact that you can't subcontract away FOIA."

There are, of course, sometimes legitimate privacy and national security reasons for withholding information. But the FOIA allows lawmakers to exempt entire categories of records from public access for any reason, a loophole that invites abuse.

Such exemptions are commonly called Exemption 3 statutes. They involve separate statutes that essentially amend FOIA to exempt certain records from disclosure, without saying why.

"One reason agencies like Exemption 3 statues is that they basically say, 'Absolutely you can't have this specific type of record,'" says Harry Hammitt, editor and publisher of Access Reports, a newsletter focused on FOIA issues. "You don't have to have a policy reason for withholding or show any harm, you just have to trot out the exemption."

The national security law Santa Clara County used to try to thwart access to its GIS database is an Exemption 3 statute designed to protect "critical infrastructure information" from disclosure. But perhaps the most egregious Exemption 3 abuse came last year, after a federal appeals court ordered the Department of Agriculture to comply with a FOIA request filed by a farm news publisher.

The publisher wanted a copy of the federal databases that show farm field boundaries across the country, as well as information on crops and acreage — data the department collects to dole out farm benefits and subsidies. The government had refused to provide the information on privacy grounds, asserting that someone could estimate a farmer's financial worth from it, and that disclosure serves no public interest.

In February of last year, a federal appeals court in Washington D.C. sided with the publisher, saying the government hadn't proven a privacy risk, and there was a public interest in letting the public monitor how the department administered billions of dollars in federal benefits. It was a victory for open-government advocates, but one that was short-lived. Three months later, Congress slipped a new Exemption 3 clause into the federal Farm Bill that trumped the court ruling. The data now remains sealed. Critics say the agriculture industry was behind it.

A separate FOIA exemption to protect trade secrets or confidential information of private industry is another common obstacle, though it only protects information voluntarily submitted to a government agency by an outside entity.

In 2006 the Center for Public Integrity collided with the trade secret exemption when it tried to add government data to its Media Tracker service, a website that allows consumers to enter a ZIP code and receive a list of companies providing TV, radio, and broadband service in their area. The center sued the Federal Communications Commission for geographical data on broadband coverage. But the FCC, after checking with AT&T and other providers, rejected the request.

"They say, 'Hey we're about to release information, please object,'" Davis says. "And then, of course, they do."

Despite all of these hurdles to get public records, Scheer sees reasons to be hopeful.

"I actually think that we're at a point where things are changing," he says. "Agencies are beginning to realize that it's a struggle to hold on to data, and it may not be worth the fight. And that goes really to the financial considerations from the costs of litigation. ...I think more enlightened public officials are coming around to that view."