Hey folks,I'm at a loss as to what's going on. This code (from what I can remember) was working before I left on Friday, yet this morning during testing I'm getting a crash.Quick explanation, it's part of a larger program to convert a GPX file into a feature class in a file geodatabase. Everything is great except when I try to determine the point's UTM coordinates. For those familiar, I'm in Canada where we use the dominion land survey. Long story short W4M = UTM Zone 12, W5M (and part of 6) is Zone 11. The code loops through the point and determines a bunch of locational information such as decimal degrees, the LSD-SEC-TWP ... etc...Here's the troublesome code: 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 = "xyz" End If pSpatialReference = pPCS pSpatialReference.SetFalseOriginAndUnits(200000, 4000000, 100) pGeogPoint = pFreshPoint pGeometry = pGeogPoint pGeometry.Project(pSpatialReference)
From what I can see, it makes it to my If statement, then crashes. I think the problem is the "pPCS = pSRFactory.CreateProjectedCoordinateSystem" line.I can't see what I'm doing wrong, all the snippets I've seen, have similar code setup. Any sort of help is much appreciated.Edit: pFreshPoint is a point feature (we're currently in a larger Do loop to run through the points and perform this to each point). Let me know if more info is required.