AnsweredAssumed Answered

Converting Lat/Long to MapPoint

Question asked by HuyHo on Aug 18, 2016
Latest reply on Aug 24, 2016 by TTilton-esristaff

When I try to convert a Lat/Long coordinate to a MapPoint (in NAD_1927_UTM_Zone_17N), I am getting two different results.  If I use GeometryEngine.Project() from a mapPoint in Wgs84 using lat/long values, I get the location in red.  When I use ConvertCoordinate.FromDecimalDegrees(), I get the blue point.  Why is there this difference?  I tried using ArcMap to locate lat/long, it gives the same location as the ConvertCoordinate class.  Funny thing is when I tried it with Google, it matches the red point.  So which is correct?


double latitude = double.Parse(LatText.Text);
double longitude = double.Parse(LongText.Text);
SpatialReference spref = new SpatialReference(2617); // NAD_1927_UTM_Zone_17N
MapPoint baseMapPoint = new MapPoint(longitude, latitude, SpatialReferences.Wgs84);
MapPoint mapPoint1 = GeometryEngine.Project(baseMapPoint, spref) as MapPoint;
_graphic1.Geometry = mapPoint1;
MapPoint mapPoint2 = ConvertCoordinate.FromDecimalDegrees(string.Format("{0},{1}", latitude, longitude), spref);
_graphic2.Geometry = mapPoint2;