I'm trying to convert coordinates from the NY State Plane Coordinate System for Long Island (zone #3104) to WGS84 using the GeoTools Java API. The latitude value is correct, but the longitude is consistently 3.665 degrees off to the west:
public static void main(String[] args) throws FactoryException, TransformException {
CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4456"); //http://www.geotoolkit.org/modules/referencing/supported-codes.html
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326");
MathTransform tr = CRS.findMathTransform(sourceCRS, targetCRS);
DirectPosition sourcePt = new GeneralDirectPosition(982394.0, 199298.0);
DirectPosition targetPt = tr.transform(sourcePt, null);
System.out.println("Source point: " + sourcePt);
System.out.println("Target point: " + targetPt);
}
The code above, earthpoint.us, and Google all return similar values for latitude: ~40.714. For longitude, earthpoint.us and Google show values of ~-74.006, but the code above produces -77.671, putting the point in the middle of Pennsylvania.
Using different source NY SPCS values produces similar errors, with the difference in longitude always being 3.665 degrees to the west and latitude being correct. GeoToolkit produces the same results.
Am I doing something wrong? Is there a 3.665 constant I should know about?
EDIT: the source values are NAD27.