Hi!I have to convert a point from one coordinate system to another.I wrote this code (VB .NET) but it doesn't work that well.The result of IsEmpty for geo and pnt, in TransPoint, is always true.Why?Public Function TransPoint(ByVal x As Double, ByVal y As Double) As IPoint
Dim cooIn As IProjectedCoordinateSystem = LoadCoordinateSystem(...)
Dim cooOut As IProjectedCoordinateSystem = LoadCoordinateSystem(...)
' --
Dim pnt As IPoint = New PointClass()
pnt.PutCoords(x, y)
' --
Dim geo As IGeometry = pnt
geo.SpatialReference = cooIn
geo.Project(cooOut)
' --
Try
Dim xx As Double = pnt.X
Dim yy As Double = pnt.Y
MsgBox("pnt: " & xx & ", " & yy)
Catch ex As Exception
MsgBox( _
"geo.isEmpty: " & geo.IsEmpty & vbNewLine & _
"pnt.isEmpty: " & pnt.IsEmpty & vbNewLine & _
ex.Message)
Return Nothing
End Try
Return pnt
End Function
Private Function LoadCoordinateSystem(ByVal src As String) As IProjectedCoordinateSystem
Dim srf As ISpatialReferenceFactory = New SpatialReferenceEnvironmentClass()
Dim pcs As IProjectedCoordinateSystem = srf.CreateESRISpatialReferenceFromPRJFile(src)
Return pcs
End Function