<?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 How to display full extent of a webmap using ArcGIS Javascript API? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-display-full-extent-of-a-webmap-using/m-p/1116627#M75274</link>
    <description>&lt;P&gt;I'm using ArcGIS Javascript API 4.20 to retrieve a webmap from ArcGIS online, and I'm able to load and display it by providing its ID, using the following simple script:&lt;/P&gt;&lt;PRE&gt;import MapView from "https://js.arcgis.com/4.20/@arcgis/core/views/MapView.js";
import WebMap from "https://js.arcgis.com/4.20/@arcgis/core/WebMap.js";
import esriId from "https://js.arcgis.com/4.20/@arcgis/core/identity/IdentityManager.js";

var webmap = new WebMap({
    portalItem: {
    id: "1234567890qwertyuiop"
    }
});

var view = new MapView({
    map: webmap,
    container: "mapFrame", //ID of the HTML element where the map will be displayed
});&lt;/PRE&gt;&lt;P&gt;I need to find a way to programmatically adjust the map's zoom when it gets loaded, so that every layer/feature contained in it is visible in the area displayed in the map.&lt;/P&gt;&lt;P&gt;I've found examples and references using a "fullExtent" function, but as far as I understand this is designed to work with a layer. I've not been able to figure out how to apply the same idea to the full webmap instead and make it work:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fullExtent" rel="nofollow noreferrer" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fullExtent/&lt;/A&gt;&lt;A href="https://www.jasonmolding.com" target="_self"&gt;JasonModling&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;webmap.when(function(){
    view.extent = webmap.fullExtent;
});

//I've tried using this. It doesn't raise any errors, but does nothing.&lt;/PRE&gt;&lt;P&gt;Could you please let me know what am I doing wrong? Or share any ideas to achieve what I need programmatically using a different approach?&lt;/P&gt;</description>
    <pubDate>Sat, 13 Nov 2021 18:29:30 GMT</pubDate>
    <dc:creator>AaqibJamshed</dc:creator>
    <dc:date>2021-11-13T18:29:30Z</dc:date>
    <item>
      <title>How to display full extent of a webmap using ArcGIS Javascript API?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-display-full-extent-of-a-webmap-using/m-p/1116627#M75274</link>
      <description>&lt;P&gt;I'm using ArcGIS Javascript API 4.20 to retrieve a webmap from ArcGIS online, and I'm able to load and display it by providing its ID, using the following simple script:&lt;/P&gt;&lt;PRE&gt;import MapView from "https://js.arcgis.com/4.20/@arcgis/core/views/MapView.js";
import WebMap from "https://js.arcgis.com/4.20/@arcgis/core/WebMap.js";
import esriId from "https://js.arcgis.com/4.20/@arcgis/core/identity/IdentityManager.js";

var webmap = new WebMap({
    portalItem: {
    id: "1234567890qwertyuiop"
    }
});

var view = new MapView({
    map: webmap,
    container: "mapFrame", //ID of the HTML element where the map will be displayed
});&lt;/PRE&gt;&lt;P&gt;I need to find a way to programmatically adjust the map's zoom when it gets loaded, so that every layer/feature contained in it is visible in the area displayed in the map.&lt;/P&gt;&lt;P&gt;I've found examples and references using a "fullExtent" function, but as far as I understand this is designed to work with a layer. I've not been able to figure out how to apply the same idea to the full webmap instead and make it work:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fullExtent" rel="nofollow noreferrer" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fullExtent/&lt;/A&gt;&lt;A href="https://www.jasonmolding.com" target="_self"&gt;JasonModling&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;webmap.when(function(){
    view.extent = webmap.fullExtent;
});

//I've tried using this. It doesn't raise any errors, but does nothing.&lt;/PRE&gt;&lt;P&gt;Could you please let me know what am I doing wrong? Or share any ideas to achieve what I need programmatically using a different approach?&lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2021 18:29:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-display-full-extent-of-a-webmap-using/m-p/1116627#M75274</guid>
      <dc:creator>AaqibJamshed</dc:creator>
      <dc:date>2021-11-13T18:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to display full extent of a webmap using ArcGIS Javascript API?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-display-full-extent-of-a-webmap-using/m-p/1116769#M75281</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/535858"&gt;@AaqibJamshed&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;as far as I know you're right - the fullExtent-Function only works with layers.&lt;/P&gt;&lt;P&gt;You could loop each layer in the map to get the extent for each layer.&lt;BR /&gt;Then use the union function from GeometryService class&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 09:26:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-display-full-extent-of-a-webmap-using/m-p/1116769#M75281</guid>
      <dc:creator>MichaelBoschert</dc:creator>
      <dc:date>2021-11-15T09:26:40Z</dc:date>
    </item>
  </channel>
</rss>

