<?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 Maximum extent in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694625#M64587</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have 2 layers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The bottom layer is the "World_Street_Map" tiled map service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The top layer is a dynamic layer covers a portion of New York State.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I set the initial extent to the extent of the dynamic layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I zoom all the way out with the ZoomSlider or with "navToolbar.zoomToFullExtent()" it zooms to the entire world. How can I constrain the map so the maximum extent is equal to the extent of the dynamic layer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;nbsp; var extentMap;
&amp;nbsp; extentMap = new esri.geometry.Extent({xmin:-8478000, ymin:5014590, xmax:-8099500, ymax:5245000, spatialReference:{wkid:102100}});
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map = new esri.Map("mapDiv", { extent: extentMap, nav:true});
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jul 2012 17:24:47 GMT</pubDate>
    <dc:creator>EricPfirman</dc:creator>
    <dc:date>2012-07-12T17:24:47Z</dc:date>
    <item>
      <title>Maximum extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694625#M64587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have 2 layers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The bottom layer is the "World_Street_Map" tiled map service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The top layer is a dynamic layer covers a portion of New York State.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I set the initial extent to the extent of the dynamic layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I zoom all the way out with the ZoomSlider or with "navToolbar.zoomToFullExtent()" it zooms to the entire world. How can I constrain the map so the maximum extent is equal to the extent of the dynamic layer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;nbsp; var extentMap;
&amp;nbsp; extentMap = new esri.geometry.Extent({xmin:-8478000, ymin:5014590, xmax:-8099500, ymax:5245000, spatialReference:{wkid:102100}});
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map = new esri.Map("mapDiv", { extent: extentMap, nav:true});
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 17:24:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694625#M64587</guid>
      <dc:creator>EricPfirman</dc:creator>
      <dc:date>2012-07-12T17:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694626#M64588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You need to define an array of &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/lod.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;LODs (Levels of Detail)&lt;/A&gt;&lt;SPAN&gt; to specify the zoom levels. Each LOD corresponds to a map at a given scale or resolution. Then, apply the array of LODs in the map constructor as an option. For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; function init() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;&lt;STRONG&gt;var lods = [
 {"level" : 13, "resolution" : 19.1092570712683, "scale" : 72223.819286},
 {"level" : 14, "resolution" : 9.55462853563415, "scale" : 36111.909643},
 {"level" : 15, "resolution" : 4.77731426794937, "scale" : 18055.954822},
 {"level" : 16, "resolution" : 2.38865713397468, "scale" : 9027.977411},
 {"level" : 17, "resolution" : 1.19432856685505, "scale" : 4513.988705},
 {"level" : 18, "resolution" : 0.597164283559817, "scale" : 2256.994353},
 {"level" : 19, "resolution" : 0.298582141647617, "scale" : 1128.497176}
 ];&lt;/STRONG&gt;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var initExtent = new esri.geometry.Extent({"xmin":-1.3074977201954123E7,"ymin":4015620.159117397,"xmax":-1.3073987658308368E7,"ymax":4016419.790346289,"spatialReference":{"wkid":102100}});
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map = new esri.Map("map",{extent:initExtent, &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;&lt;STRONG&gt;lods:lods&lt;/STRONG&gt;&lt;/SPAN&gt;});
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayer(basemap); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var dynamicLyr = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/MapServer");&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayer(dynamicLyr);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.connect(map, 'onLoad', function(theMap) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FYI: You can look into the &lt;/SPAN&gt;&lt;A href="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" rel="nofollow noopener noreferrer" target="_blank"&gt; REST endpoint of the World_Street_Map service &lt;/A&gt;&lt;SPAN&gt; and pick the LODs you need. If you decide to use another tiled map service, make sure you look into that service's REST endpoint and pick up the correct LODs.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:14:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694626#M64588</guid>
      <dc:creator>SiqiLi</dc:creator>
      <dc:date>2021-12-12T05:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694627#M64589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Note that this only restricts you to the same &lt;/SPAN&gt;&lt;STRONG&gt;zoom level&lt;/STRONG&gt;&lt;SPAN&gt; as the maximum extent of the layer - you'll still be able to pan to another location.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If that's a problem (ie, you want to prevent the user from navigating away from the study area) you could write a function which examines the map extent after panning or zooming (see the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/map.htm#onExtentChange"&gt;onExtentChange&lt;/A&gt;&lt;SPAN&gt; event) and nudges it back to the desired extent.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2012 09:21:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694627#M64589</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2012-07-13T09:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694628#M64590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Note that this only restricts you to the same &lt;STRONG&gt;zoom level&lt;/STRONG&gt; as the maximum extent of the layer - you'll still be able to pan to another location.&lt;BR /&gt;&lt;BR /&gt;If that's a problem (ie, you want to prevent the user from navigating away from the study area) you could write a function which examines the map extent after panning or zooming (see the &lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/map.htm#onExtentChange"&gt;onExtentChange&lt;/A&gt; event) and nudges it back to the desired extent.&lt;BR /&gt;&lt;BR /&gt;Steve&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Indeed, I'd like to prevent the user from navigating away from the study area. I'm not really a crack in writing functions using JavaScript. How should such a function look like?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 09:27:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694628#M64590</guid>
      <dc:creator>LaurensZwakhals</dc:creator>
      <dc:date>2013-02-20T09:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694629#M64591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To get started, I'd suggest you install Firefox and &lt;/SPAN&gt;&lt;A href="http://getfirebug.com/"&gt;Firebug&lt;/A&gt;&lt;SPAN&gt; and spend some time playing around with the developer tools. Learn how to put a breakpoint into code and inspect what's happening.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then add a listener for the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#Map/onExtentChange"&gt;onExtentChange&lt;/A&gt;&lt;SPAN&gt; event so you can see what happens when your map's extent changes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Inside this function, put some logic which ensures that the user hasn't moved outside your study area - if they have, move the map back again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 20:28:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694629#M64591</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2013-02-20T20:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694630#M64592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello, they have the solution to your question here&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/27971-Constrain-Map-Extent?highlight=constrain"&gt;http://forums.arcgis.com/threads/27971-Constrain-Map-Extent?highlight=constrain&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2013 13:39:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/maximum-extent/m-p/694630#M64592</guid>
      <dc:creator>HaroldBostic</dc:creator>
      <dc:date>2013-03-14T13:39:39Z</dc:date>
    </item>
  </channel>
</rss>

