1

I am working on a project in which i need to calculate the points form on CRS to another, but as we the source and target CRS are only determine on runtime.

ISpatialReference source = GCS_North_American_1983

ISpatialReference target = UTM Zone 13 North (108 W - 102 W Longitude)

IEnvelope extent = rasterLayer.VisibleExtent;

Console.WriteLine(extent.XMax);   == -97.815540361118

Console.WriteLine(extent.XMin);   == -102.045540576002

Console.WriteLine(extent.YMax);   == 39.933228902485

Console.WriteLine(extent.YMin);   == 37.113228759229

IGeoTransformation geoTransformation = "NAD_1927_To_NAD_1983_NADCON"

geoTransformationOperationSet.Set(esriTransformDirection.esriTransformForward, geoTransformation);
            geoTransformationOperationSet.Set(esriTransformDirection.esriTransformReverse, geoTransformation);

//So we need to go in reverse order. as source is in NAD83 and Target is in NAD27. and returns correct results matched with ArcMap but going forward results wrong output.

geometry.ProjectEx(target, esriTransformDirection.esriTransformReverse, geoTransformation, false, 0.0, 0.0);


Console.WriteLine(extent.XMax);  ==  1138797.89197912

Console.WriteLine(extent.XMin);  ==  752503.366222885

Console.WriteLine(extent.YMax);  ==  4444925.18943959

Console.WriteLine(extent.YMin);  ==  4111314.85519851

if we do the forward transformation return incorrect result.

1138738.17611084

752424.161510695

4444923.04572637

4111317.16066915

So how can I determine which direction we need to use? Like forward/reverse. Is there any way we can find out using arcobject API return use fwd or reverse. I looked into the IGeoTransformation but no success, there are many different predefined GeoTransformation which can use in both fwd or reverse if supported.

Thanks.

Vasfed
  • 18,013
  • 10
  • 47
  • 53
Usman
  • 11
  • 2

0 Answers0