[Proj] cs2cs giving different result than ImportportFromProj4 in a C# program

Bjørn Krangnes bkr at devonor.com
Thu Jan 27 10:45:54 EST 2011


cs2cs is giving this result (Irish Transverse Mercator to IrishGrid75):

C:\Program Files (x86)\FWTools2.4.7>cs2cs +proj=tmerc +lat_0=53.5 +lon_0=-8
+k=0

.999820 +x_0=600000 +y_0=750000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m
+no

_defs +to +proj=tmerc +lat_0=53.5 +lon_0=-8 +k=1.000035 +x_0=200000
+y_0=250000

+a=6377340.189 +b=6356034.447938534
+towgs84=482.530,-130.596,564.557,-1.042,-0.

214,-0.631,8.15 +units=m +no_defs

600000.0 700000.0

200049.28       199965.72 -54.78

 

The correct result is:  E: 200049.410 N: 199965.743

The result from cs2cs is very close to the correct result.

 

But when I use the following code in a c# program the result is not the same
as cs2cs

 

SpatialReference input = new OSGeo.OSR.SpatialReference(null);

SpatialReference output = new OSGeo.OSR.SpatialReference(null);

 

int istati = input.ImportFromProj4("+proj=tmerc +lat_0=53.5 +lon_0=-8
+k=0.999820 +x_0=600000 +y_0=750000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0
+units=m +no_defs");   // ITM

int istato = output.ImportFromProj4("+proj=tmerc +lat_0=53.5 +lon_0=-8
+k=1.000035 +x_0=200000 +y_0=250000 +a=6377340.189 +b=6356034.447938534
+towgs84=482.530,-130.596,564.557,-1.42,-0.214,-0.631,8.15 +units=m +wktext
+no_defs <>)");   // IG

CoordinateTransformation tra = new CoordinateTransformation(input, output);

double[] xy = new double[3];

xy[0] = 600000.0;

xy[1] = 700000.0;

xy[2] = 0;

tra.TransformPoint(xy);

 

After execution xy[0]= 200040.069 and xy[1]= 199964.097. This is about 9
meters off in east and 1.7 in north.

 

Any reason why I should get 2 different results? 

 

Regards

Bjørn

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20110127/fa3d93fe/attachment.htm 


More information about the Proj mailing list