[gdal-dev] How do I convert LL to UTM?

dev4cx4m9z at snkmail.com dev4cx4m9z at snkmail.com
Sat Sep 24 08:31:16 EDT 2011


Can anybody see what I'm doing wrong (and don't say writing it in VB.NET) in
my logic of converting a Lat/Long to UTM?

 

   Dim MapSRS As New OGRSpatialReference       ' Coordinate system of map

   Dim UTMSRS As New OGRSpatialReference       ' Coordinate system for UTM

   Dim CT As OGRCoordinateTransformation       ' Coordinate transform from
map to UTM

   Dim GDALError As NCSError

 

   GDALError = WGS84SRS.SetWellKnownGeogCS("WGS84")          ' Define WGS84
coordinate system

   GDALError = UTMSRS.SetWellKnownGeogCS("WGS84")              ' Define a
UTM coordinate system

   

   GDALError = UTMSRS.SetUTM(55, false)

   CT = CreateCoordinateTransformation(MapSRS, UTMSRS)        ' Create a
coordinate transformation

 

   UTMeast = cursor.X : UTMnorth = cursor.Y            ' cursor.X = Lon;
cursor.Y = Lat

   Success = CT.TransformPoint(UTMeast, UTMnorth, 0)           ' Transform
the point

 

Success returns false, and UTMeast = -505516.60123597935 and UTMnorth =
9999959.7180830985

 

_______________________________________

Marc Hillman, Melbourne, Australia

 <http://users.tpg.com.au/users/mhillman/>
http://users.tpg.com.au/users/mhillman/

marc .hillman @ t p g . c o m . a u

Eagles may soar, but weasels don't get sucked into jet engines.

Early bird gets the worm, but the second mouse gets the cheese.

If Barbie is so popular, why do you have to buy her friends?

All those who believe in psychokinesis, raise my hand.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110924/d838629a/attachment.html


More information about the gdal-dev mailing list