Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a set of coordinates; Lon 9.42221521, Lat 56.44978001 and I want to convert them to UTM Zone 32N coordinates. I found the SQLSpatialTools library to do the conversion but I need some help. When I use the following code:

SqlChars chars = new SqlChars(string.Format("POINT({0} {1})", lon, lat));
        SqlGeography mapPoint = SqlGeography.STPointFromText(chars, 4326);

        SqlProjection proj = new SqlProjection();
        proj = SqlProjection.TranverseMercator(0);  //(or Mercator)
        SqlGeometry geometry = proj.Project(mapPoint);
        geometry.STSrid = 25832;

        SQLSpatialTools.AffineTransform affTrans = new AffineTransform();
        SqlGeometry newPoint = AffineTransform.Scale(6378137, 6378137).Apply(geometry);

...the lon lat set gets converted to 578664.03 - 6323756.73

If I check the lon lat set in ArcMAP I get the following values: 526026.284 - 6256221.368

...so obviously I must be doing something wrong. I'm using SQLSpatialTools because it's easier for me to perform some spatial queries later.

Thanks!

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.