Select to view content in your preferred language

Getting some problem when we call toScreen() method

436
1
08-21-2022 10:19 PM
GrowthLadder
New Contributor

We are going to get the ScreenPoint of a MapPoint. When we are using the map-point as center of the map and then using the toScreen() method then we are getting the ScreenPoint with the value of x & y as NaN. We are using the API version 3.x

Please help why the x and y property value is NaN 

 

Tags (2)
0 Kudos
1 Reply
JoelBennett
MVP Regular Contributor

Without seeing your code, it's impossible to tell what's causing the problem.  However, to accomplish what you're trying to do, I would recommend something like the following:

var mapCenter = map.extent.getCenter();
var screenCenter = map.toScreen(mapCenter);

console.info(screenCenter.x.toString() + ", " + screenCenter.y.toString());

 

0 Kudos