AnsweredAssumed Answered

AGSMapView.locationToScreen returns (nan,nan)

Question asked by worthsparks on Feb 2, 2018
Latest reply on Feb 13, 2018 by worthsparks

My app displays spatially accurate graphics in a view on top of the mapView. To do so, I perform on-the-fly transformations for the graphics from within viewpointChangedHandler. Sometimes on first load, some of the graphics don't show on the screen where they should. After much debugging, I have discovered that even though the mapView.map has been loaded, calling mapView.locationToScreen() returns a CGPoint where both x and y are NaN, CGPoint(x: nan, y: nan).

 

The map is already AGSLoadStatusLoaded. But obviously, I'm trying to do this too soon. What trigger or observable on the mapView or mapView.map can I use to know when mapView.locationToScreen is ready to return good screen coordinates?

Outcomes