AnsweredAssumed Answered

toScreen returning null

Question asked by lalver1 on Mar 20, 2018
Latest reply on Mar 20, 2018 by lalver1

Hi,

I am trying to obtain the screen coordinates of a particular location in a MapView using a code similar to this:

var webmap = new WebMap({...});
var view = new MapView({...});
var lat = Number(32.473565);
var lon = Number(-93.791870);
var testPoint = new Point({type: "point", latitude: lat, longitude: lon});
var testScreen = view.toScreen(testPoint);

However, I keep getting a null testScreen variable. I assume the error is in line 5, but the Point object gets created, it seems, without any errors. I left out the require statements but I am including "esri/geometry/Point" and
"esri/geometry/ScreenPoint". Could someone provide some sample code that shows how to use toScreen to go from a given latitude/longitude to screen coordinates?

Thanks.

Outcomes