<?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 Zoom to extent - Graphics Layer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-extent-graphics-layer/m-p/408368#M37630</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am&amp;nbsp;using JS 4x and have developed a functionality that draws a graphic point layer on the map when it satisfies a query for a feature layer. When the functionality runs, it would be ideal if the map can zoom to the extent of the graphic layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, using the code&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;graphicLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;when&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;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;extent &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; graphicLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;fullExtent&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I still could not achieve the zooming to extent functionality. In some cases it zooms to the entire extent of the basemap and in some cases not. Even that was a bit bizarre.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would someone please point out how to achieve this functionality?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some additional information:&lt;/P&gt;&lt;P&gt;I also read online that a mismatch in spatial reference could be a cause of the queryExtent() feature not working and I assumed it might be the same reason for the fullExtent.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Originally,&lt;/P&gt;&lt;P&gt;Basemap - 3857 Web Mercator Projection (topo-vector from ESRI)&lt;/P&gt;&lt;P&gt;Queried feature Layer - 28992 RD-New&lt;/P&gt;&lt;P&gt;Graphic Layer - 4326 (for container) but 28992 for features returned&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also changed the basemap to RD-New but I am unable to set the graphic layer container projection using the following line of code.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;graphicLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;outSpatialReference &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;spatialReference&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I also checked &lt;A _jive_internal="true" href="https://community.esri.com/thread/27405" target="_blank"&gt;online&lt;/A&gt; that it is not possible to set it. If this has been updated, it would be nice to know.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I am performing another function to zoomToExtent of a feature layer using the queryExtent() function and despite the mismatch between the basemap projection and the feature layer projection, that works!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any pointers to achieve this would be very helpful!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 18:34:19 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-12-11T18:34:19Z</dc:date>
    <item>
      <title>Zoom to extent - Graphics Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-extent-graphics-layer/m-p/408368#M37630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am&amp;nbsp;using JS 4x and have developed a functionality that draws a graphic point layer on the map when it satisfies a query for a feature layer. When the functionality runs, it would be ideal if the map can zoom to the extent of the graphic layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, using the code&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;graphicLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;when&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;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;extent &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; graphicLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;fullExtent&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I still could not achieve the zooming to extent functionality. In some cases it zooms to the entire extent of the basemap and in some cases not. Even that was a bit bizarre.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would someone please point out how to achieve this functionality?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some additional information:&lt;/P&gt;&lt;P&gt;I also read online that a mismatch in spatial reference could be a cause of the queryExtent() feature not working and I assumed it might be the same reason for the fullExtent.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Originally,&lt;/P&gt;&lt;P&gt;Basemap - 3857 Web Mercator Projection (topo-vector from ESRI)&lt;/P&gt;&lt;P&gt;Queried feature Layer - 28992 RD-New&lt;/P&gt;&lt;P&gt;Graphic Layer - 4326 (for container) but 28992 for features returned&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also changed the basemap to RD-New but I am unable to set the graphic layer container projection using the following line of code.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;graphicLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;outSpatialReference &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;spatialReference&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I also checked &lt;A _jive_internal="true" href="https://community.esri.com/thread/27405" target="_blank"&gt;online&lt;/A&gt; that it is not possible to set it. If this has been updated, it would be nice to know.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I am performing another function to zoomToExtent of a feature layer using the queryExtent() function and despite the mismatch between the basemap projection and the feature layer projection, that works!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any pointers to achieve this would be very helpful!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:34:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-extent-graphics-layer/m-p/408368#M37630</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T18:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to extent - Graphics Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-extent-graphics-layer/m-p/408369#M37631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sravanthi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;When you query a layer from ArcGIS Server or AGOL you can specify the outSpatialRefernce of the results. When trying to zoom to a graphic it needs to be in the same spatial reference as the view. I see in your post above you tried&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;graphicLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;outSpatialReference &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;spatialReference&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;P&gt;The graphicslayer class does Not have an&amp;nbsp;outSpatialReference property. The Query class does though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 May 2020 12:36:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-extent-graphics-layer/m-p/408369#M37631</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-05-11T12:36:00Z</dc:date>
    </item>
  </channel>
</rss>

