I'm currently testing a web app that calculates EPSG:2163 coordinates based on user interaction with a map created through d3.js. I wish to convert these coordinates to WGS84 in order to use various APIs whose parameters are in the form of WGS84 coordinates. Is there an simple formula or javascript library that can do this?
To further clarify, the map seen http://spatialreference.org/ref/epsg/2163/ takes WGS84 coordinates as input and converts them to EPSG:2163. All I want to do is reverse that calculation.
EDIT
Here's an example, however, I'm not convinced I'm getting correct results. I started with WGS84 coordinates and projected them to epsg:2163 using cs2cs. In the Javascript I transform the epsg:2163 coordinates back to WGS84, but as you will see, they don't end up the same as my starting coordinates. I'm a little puzzled, myself, and I sure could have botched a step:
<html>
<head>
<script src="proj4js/lib/proj4js-compressed.js"></script>
<!-- Omit the next line if you don't mind requesting the parameters for EPSG:2163 from spatialreference.org -->
<script src="proj4js/lib/defs/EPSG2163.js"></script>
<script>
// Transformed these WGS84 coordinates in cs2cs to produce EPSG:2163 coordinates in "coords"
var coords84 = [
[-98.0, 29.0],
[-101.2, 30.8],
[-102.1, 27.4],
[-97.8, 30.2]
];
var coords = [
[196396.96, -1771089.12],
[-115495.45, -1574127.29],
[-209758.25, -1946836.60],
[213174.20, -1638406.38]
];
var src = new Proj4js.Proj('EPSG:2163');
var dest = new Proj4js.Proj('EPSG:4326');
function project() {
for(var inx=0;inx<coords.length;inx++) {
pt = new Proj4js.Point(coords[inx][0],coords[inx][1]);
Proj4js.transform(src,dest,pt);
document.body.innerHTML += ("<p>Proj4js:" + pt.x + ", " + pt.y + "</p>");
document.body.innerHTML += ("<p>Expected:" + coords84[inx][0] + ", " + coords84[inx][1] + "</p>");
}
}
</script>
</head>
<body>
<input type="button" value="Project" onclick="javascript:project();" />
</body>
</html>