Dear Gurus!Can't anybody say how to transformate X,Y of the point to lon,lat value?I have previously used (when working with arcgis engine) ESRI.ArcGIS.Geometry primitives as follows: private void initPcsGcs()
{
ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass();
// GCS to project from
ISpatialReference gcs = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
ISpatialReference pcs = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_Pulkovo1942GK_6);
sr1 = gcs;
sr1.SetFalseOriginAndUnits(-180, -90, 1000000);
//Projected Coordinate System to project into
pcs.SetFalseOriginAndUnits(0, 0, 1000);
sr2 = pcs;
}
public void LonLatToXY(double lon, double lat, out double X, out double Y)
{
initPcsGcs();
IPoint point = new PointClass() as IPoint;
point.PutCoords(lon, lat);
IGeometry geometry;
geometry = point;
geometry.SpatialReference = sr1;
geometry.Project(sr2);
point = geometry as IPoint;
point.QueryCoords(out X, out Y);
}
public bool xyTOlonLat(double X, double Y, out double lon, out double lat)
{
ISpatialReferenceFactory srFactory;
srFactory = new SpatialReferenceEnvironmentClass();
IGeographicCoordinateSystem gcs;
IProjectedCoordinateSystem pcs;
gcs = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
pcs = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_Pulkovo1942GK_6);
IPoint point = new PointClass() as IPoint;
point.PutCoords(X, Y);
IGeometry geometry;
geometry = point;
geometry.SpatialReference = sr2;
geometry.Project(sr1);
point = geometry as IPoint;
point.QueryCoords(out lon, out lat);
return true;
}