public IPoint ProjectWgsToPulkovoWithGeoTransformation(IPoint inputPoint, CoordinateSystemModel coordinateSystemModel, esriTransformDirection transformationDirection) { if (inputPoint == null) { return(null); } var bufferPoint = new PointClass { X = inputPoint.X, Y = inputPoint.Y, SpatialReference = inputPoint.SpatialReference }; //Create Spatial Reference Factory var spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); var targetSpatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem(coordinateSystemModel.ESRIWellKnownID); var coordinateFrameGeoTransformation = new CoordinateFrameTransformationClass(); coordinateFrameGeoTransformation.PutSpatialReferences(bufferPoint.SpatialReference, targetSpatialReference); coordinateFrameGeoTransformation.PutParameters(Constants.PulkovoToWGS.XAxisTranslation, Constants.PulkovoToWGS.YAxisTranslation, Constants.PulkovoToWGS.ZAxisTranslation, Constants.PulkovoToWGS.XAxisRotation, Constants.PulkovoToWGS.YAxisRotation, Constants.PulkovoToWGS.ZAxisRotation, Constants.PulkovoToWGS.ScaleDifference); var geometry = bufferPoint as IGeometry5; geometry.ProjectEx(targetSpatialReference, transformationDirection, coordinateFrameGeoTransformation, false, 0.0, 0.0); return(geometry as IPoint); }
public IPoint CreatePoint(double X, double Y, CoordinateSystemModel geoModel, bool createGeoCoordinateSystem = false) { var resultPoint = new PointClass(); resultPoint.PutCoords(X, Y); //Create Spatial Reference Factory var spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); ISpatialReference spatialReference; if (createGeoCoordinateSystem) { //Geographical Coordinate System spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem(geoModel.ESRIWellKnownID); } else { //Projected Coordinate System to project into spatialReference = spatialReferenceFactory.CreateProjectedCoordinateSystem(geoModel.ESRIWellKnownID); } spatialReference.SetFalseOriginAndUnits(geoModel.FalseOriginX, geoModel.FalseOriginY, geoModel.Units); resultPoint.SpatialReference = spatialReference; return(resultPoint); }
public IPoint ProjectPoint(IPoint inputPoint, CoordinateSystemModel singleProjectionModel) { if (inputPoint == null) { return(null); } var bufferPoint = new PointClass { X = inputPoint.X, Y = inputPoint.Y, SpatialReference = inputPoint.SpatialReference }; //Create Spatial Reference Factory var spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); //Projected Coordinate System to project into var projectedCoordinateSystem = spatialReferenceFactory.CreateProjectedCoordinateSystem(singleProjectionModel.ESRIWellKnownID); projectedCoordinateSystem.SetFalseOriginAndUnits( singleProjectionModel.FalseOriginX, singleProjectionModel.FalseOriginY, singleProjectionModel.Units); bufferPoint.Project(projectedCoordinateSystem); return(bufferPoint); }
public IPoint ConvertToDecimalDegrees(IPoint point, CoordinateSystemModel coordinateSystemModel) { var spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); //Create Spatial Reference ISpatialReference spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem(coordinateSystemModel.ESRIWellKnownID); spatialReference.SetFalseOriginAndUnits(coordinateSystemModel.FalseOriginX, coordinateSystemModel.FalseOriginY, coordinateSystemModel.Units); point.Project(spatialReference); return(point); }
public IPoint ConvertFromUtm(string utmInputValue, CoordinateSystemModel coordinateSystemModel) { var resultPoint = new Point(); //Create Spatial Reference Factory var spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); //Create Spatial Reference ISpatialReference spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem(coordinateSystemModel.ESRIWellKnownID); spatialReference.SetFalseOriginAndUnits(coordinateSystemModel.FalseOriginX, coordinateSystemModel.FalseOriginY, coordinateSystemModel.Units); resultPoint.SpatialReference = spatialReference; (resultPoint as IConversionNotation).PutCoordsFromUTM(esriUTMConversionOptionsEnum.esriUTMAddSpaces, utmInputValue); return(resultPoint); }
public IPoint ConvertFromMgrs(string mgrsInputValue, CoordinateSystemModel coordinateSystemModel) { var resultPoint = new Point(); //Create Spatial Reference Factory var spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); //Create Spatial Reference ISpatialReference spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem(coordinateSystemModel.ESRIWellKnownID); spatialReference.SetFalseOriginAndUnits(coordinateSystemModel.FalseOriginX, coordinateSystemModel.FalseOriginY, coordinateSystemModel.Units); resultPoint.SpatialReference = spatialReference; (resultPoint as IConversionMGRS).PutCoordsFromMGRS(mgrsInputValue, esriMGRSModeEnum.esriMGRSMode_Automatic); return(resultPoint); }
public IPoint ProjectWgsToUrkaine2000WithGeoTransformation( IPoint inputPoint, CoordinateSystemModel coordinateSystemModel, esriTransformDirection transformationDirection) { if (inputPoint == null) { return(null); } var bufferPoint = new PointClass { X = inputPoint.X, Y = inputPoint.Y, SpatialReference = inputPoint.SpatialReference }; //Create Spatial Reference Factory var spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); var targetSpatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem(coordinateSystemModel.ESRIWellKnownID); var compositeGeoTransformation = new CompositeGeoTransformationClass(); var predefinedGeoTransformation = spatialReferenceFactory.CreateGeoTransformation(Constants.ItrfToWgsGeoTransformationID) as IGeoTransformation; compositeGeoTransformation.Add(esriTransformDirection.esriTransformReverse, predefinedGeoTransformation); var coordinateFrameGeoTransformation = new CoordinateFrameTransformationClass(); var itrfSpatialReference = spatialReferenceFactory.CreateSpatialReference((int)esriSRGeoCS3Type.esriSRGeoCS_IERSTerrestrialReferenceFrame2000); coordinateFrameGeoTransformation.PutSpatialReferences(itrfSpatialReference, targetSpatialReference); coordinateFrameGeoTransformation.PutParameters( Constants.UkraineToItrf.XAxisTranslation, Constants.UkraineToItrf.YAxisTranslation, Constants.UkraineToItrf.ZAxisTranslation, Constants.UkraineToItrf.XAxisRotation, Constants.UkraineToItrf.YAxisRotation, Constants.UkraineToItrf.ZAxisRotation, Constants.UkraineToItrf.ScaleDifference); compositeGeoTransformation.Add(esriTransformDirection.esriTransformForward, coordinateFrameGeoTransformation); var geometry = bufferPoint as IGeometry5; geometry.ProjectEx(targetSpatialReference, transformationDirection, compositeGeoTransformation, false, 0.0, 0.0); return(geometry as IPoint); }