<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: MapView toScreen returns wrong screenpoint in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-toscreen-returns-wrong-screenpoint/m-p/748474#M69246</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Eemeli,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Why are you using the basmapView and not just the _view to get the screen point?&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; screenPt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; _view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;toScreen&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;point&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Sep 2019 13:00:21 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2019-09-11T13:00:21Z</dc:date>
    <item>
      <title>MapView toScreen returns wrong screenpoint</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-toscreen-returns-wrong-screenpoint/m-p/748473#M69245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; point &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;Point&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
point&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;longitude &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"-2.12953405978807"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
point&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;latitude &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"50.6877745154717"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// screenPt is x: 1210, y: 416 although it should be something like x: 959  &amp;amp; y: 528.&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; screenPt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; _view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;basemapView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;toScreen&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; point &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:49:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-toscreen-returns-wrong-screenpoint/m-p/748473#M69245</guid>
      <dc:creator>EemeliP</dc:creator>
      <dc:date>2021-12-12T07:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: MapView toScreen returns wrong screenpoint</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-toscreen-returns-wrong-screenpoint/m-p/748474#M69246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Eemeli,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Why are you using the basmapView and not just the _view to get the screen point?&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; screenPt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; _view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;toScreen&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;point&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2019 13:00:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-toscreen-returns-wrong-screenpoint/m-p/748474#M69246</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-09-11T13:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: MapView toScreen returns wrong screenpoint</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-toscreen-returns-wrong-screenpoint/m-p/748475#M69247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually using "basemapView.view" was just the last experiment I had and accidentally left it there as an example. I have the same result when using "_view": the generated screen point is out of screen.&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;"&gt;var&lt;/SPAN&gt; screenPt &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; _view&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #d74444; border: 0px; font-weight: inherit;"&gt;toScreen&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt; point &lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2019 04:35:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-toscreen-returns-wrong-screenpoint/m-p/748475#M69247</guid>
      <dc:creator>EemeliP</dc:creator>
      <dc:date>2019-09-12T04:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: MapView toScreen returns wrong screenpoint</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-toscreen-returns-wrong-screenpoint/m-p/748476#M69248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I think I was able to resolve this. It was about timing as there was on-going "pan" and therefore the original point was "moving on the screen" and the resulted screenpoint was more or less random.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I fixed this by waiting that the view animation is done:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;_view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;watch&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"animation"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; response &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;

     &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; response &lt;SPAN class="operator token"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt; response&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;state &lt;SPAN class="operator token"&gt;!==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"running"&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;

           &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; screenPt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; _view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;toScreen&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; point &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
     &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍


&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:49:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-toscreen-returns-wrong-screenpoint/m-p/748476#M69248</guid>
      <dc:creator>EemeliP</dc:creator>
      <dc:date>2021-12-12T07:49:09Z</dc:date>
    </item>
  </channel>
</rss>

