AnsweredAssumed Answered

LocationToScreen result is absurd...

Question asked by GarGueg on Nov 7, 2018
Latest reply on Nov 8, 2018 by mnielsen-esristaff

Hi ! 
I'm using the method LocationToScreen (I'm in .NET) to place icons on my map but the result I have with it is absurd... Like a point with -70000, 10000. 

 

I don't get why because I use ScreenToLocation to get geographic coordinates with success.

 

Here is the method with LocationToScreen inside : 

 

public void GetMapPointCoordinates()
{
var targetLatitude = ConvertDMSToDD(DisplayedTargetLatitude);
var targetLongitude = ConvertDMSToDD(DisplayedTargetLongitude);
MapPoint mapPoint = new MapPoint(targetLatitude, targetLongitude, ViewRadarMap.MapFranceOffLine.Map.SpatialReference);
Point pt = ViewRadarMap.MapFranceOffLine.LocationToScreen(mapPoint);
double marginBottom = ViewRadarMap.ActualHeight - pt.Y;
double marginRight = ViewRadarMap.ActualWidth - pt.X;
_iconPosition.Bottom = marginBottom - 40;
_iconPosition.Right = marginRight - 40;
_iconPosition.Top = pt.Y - 40;
_iconPosition.Left = pt.X - 40;
ViewRadarMap.TargetPositionIcon.Margin = IconPosition;
ViewRadarMap.IconNeutral.Margin = IconPosition;

}

 

I tried to change the SpatialReferences but the result is still absurd...
Help me pleeeeaaase !

Outcomes