Dim pPCS As IProjectedCoordinateSystem Dim pSRFactory As ISpatialReferenceFactory2 Dim pSpatialReference As ISpatialReference Dim pGeometry As IGeometry Dim pGeogPoint As IPoint pSRFactory = New SpatialReferenceEnvironment If iMer = 4 Then pPCS = pSRFactory.CreateProjectedCoordinateSystem(ESRI.ArcGIS.Geometry.esriSRProjCSType.esriSRProjCS_NAD1983UTM_12N) sZone = "12U" ElseIf iMer = 5 Or iMer = 6 Then pPCS = pSRFactory.CreateProjectedCoordinateSystem(ESRI.ArcGIS.Geometry.esriSRProjCSType.esriSRProjCS_NAD1983UTM_11N) sZone = "11U" Else pPCS = Nothing sZone = "xxx" End If pSpatialReference = pPCS pSpatialReference.SetFalseOriginAndUnits(200000, 4000000, 100) pGeogPoint = pFreshPoint pGeometry = pGeogPoint pGeometry.Project(pSpatialReference)
Solved! Go to Solution.
Try Dim pPCS As IProjectedCoordinateSystem Dim pSRFactory As ISpatialReferenceFactory2 Dim pSpatialReference As ISpatialReference Dim pGeometry As IGeometry Dim pGeogPoint As IPoint pSRFactory = New SpatialReferenceEnvironment If iMer = 4 Then pPCS = pSRFactory.CreateProjectedCoordinateSystem(26911) sZone = "12U" ElseIf iMer = 5 Or iMer = 6 Then pPCS = pSRFactory.CreateProjectedCoordinateSystem(26912) sZone = "11U" Else pPCS = Nothing sZone = "xxx" End If pGeogPoint = pFreshPoint pSpatialReference = pPCS pSpatialReference.SetFalseOriginAndUnits(200000, 4000000, 100) pGeometry = pFreshPoint pGeometry.Project(pSpatialReference) Catch ex As Exception ' Print generic exception messages. Console.WriteLine(ex.Message) End Try