Hi,
I have an application that loads a Webmap from portal using ArcGIS JS version 4.12. Then I navigate to certain point with MapView goTo function. That works fine. Then I need to convert the Point into ScreenPoint in order to do a hittest. When I do the "toScreen" conversion it returns a point on screen that is not on the right place.
Am I missing something here, or should somehow take the spatial reference of the map into account. The Point I create from x and y coordinates points into the right place. Why does the "toScreen" point into a wrong place even though the goto leads into right place? I have tried to change or set different spatial references for the point before "toScreen" but it does not seem to help.
Example:
<SPAN class="keyword token">var</SPAN> point <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Point</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
point<SPAN class="punctuation token">.</SPAN>longitude <SPAN class="operator token">=</SPAN> <SPAN class="string token">"-2.12953405978807"</SPAN><SPAN class="punctuation token">;</SPAN>
point<SPAN class="punctuation token">.</SPAN>latitude <SPAN class="operator token">=</SPAN> <SPAN class="string token">"50.6877745154717"</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// screenPt is x: 1210, y: 416 although it should be something like x: 959 & y: 528.</SPAN>
<SPAN class="keyword token">var</SPAN> screenPt <SPAN class="operator token">=</SPAN> _view<SPAN class="punctuation token">.</SPAN>basemapView<SPAN class="punctuation token">.</SPAN>view<SPAN class="punctuation token">.</SPAN><SPAN class="token function">toScreen</SPAN><SPAN class="punctuation token">(</SPAN> point <SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>