AnsweredAssumed Answered

Issues Repojecting a Point using VB.Net...

Question asked by rkoc on Jul 30, 2012
Latest reply on Aug 8, 2012 by rkoc
Hi,

I'm having some issues reprojecting a point (as IPoint) from a projected coordinate system to geographic. After the pGeometry.project command, I end up with empty geometry - I'm not sure why.

After setting the point's spatial reference, I set the geomerty (using putCoords).
I then use IGeomerty.Project method to reproject the point (which would appear stage that everthing goes horribly wrong).

I've posted my code is below - Any help would be appriciated.

FYI - ArcMap 9.3.1, VB.Net, Visual Studio 2008 Express


 Dim pSpatialReferenceFactory As ISpatialReferenceFactory         pSpatialReferenceFactory = New SpatialReferenceEnvironment          Dim pGeographicCoordinateSystem As IGeographicCoordinateSystem         pGeographicCoordinateSystem = pSpatialReferenceFactory.CreateGeographicCoordinateSystem(4283) 'EPSG for GDA94 (LL)          Dim pProjectedCoordinateSystem As IProjectedCoordinateSystem         pProjectedCoordinateSystem = pSpatialReferenceFactory.CreateProjectedCoordinateSystem(28350) 'EPSG for MGA94 Zone 50          Dim pSpatialReference As ISpatialReference         pSpatialReference = pProjectedCoordinateSystem          Dim pGeomerty As IGeometry                  Dim pPoint As IPoint         pPoint = New ESRI.ArcGIS.Geometry.Point         pPoint.SpatialReference = pProjectedCoordinateSystem          pPoint.PutCoords(pRasterLy.VisibleExtent.XMax - pRasterLy.VisibleExtent.XMin, pRasterLy.VisibleExtent.YMaxpRasterLy.VisibleExtent.YMin)          pGeomerty = pPoint         pGeomerty.SpatialReference = pSpatialReference          MsgBox(pGeomerty.IsEmpty)  ' *** returns false ****          pSpatialReference = pGeographicCoordinateSystem         pGeomerty.Project(pSpatialReference)         MsgBox(pGeomerty.SpatialReference.Name)         MsgBox(pGeomerty.IsEmpty) ' *** returns true ****         MsgBox(pGeomerty.Envelope.XMax) ' *** error thrown when tring to a ccess the geometry ***

Outcomes