<?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 Scale - ArcGIS.com - Basic Viewer Template in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188599#M9303</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In arcgis.com I created a web map that consumes multiple map and feature services.&amp;nbsp; I then created a web application from this web map using the basic viewer web template.&amp;nbsp; I am hosting this template on our server so that I can customize the geocoder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My problem is that when I type in an address (611 Walker or 6510 Westview Dr) it zooms out to the scale of the county and requires you to manually zoom to the address you typed in.&amp;nbsp; Instead of just zooming directly to the location.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried inserting this little ditty "map.centerAndZoom(geom,19)" but I cant seem to find the correct place to place it.&amp;nbsp; I am beginning to wonder if this is just a downfall of using a template.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone know of a way to zoom to a location using the templates?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Feb 2012 16:37:44 GMT</pubDate>
    <dc:creator>deleted-user-FYWnb7WVNuhY</dc:creator>
    <dc:date>2012-02-07T16:37:44Z</dc:date>
    <item>
      <title>Zoom Scale - ArcGIS.com - Basic Viewer Template</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188599#M9303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In arcgis.com I created a web map that consumes multiple map and feature services.&amp;nbsp; I then created a web application from this web map using the basic viewer web template.&amp;nbsp; I am hosting this template on our server so that I can customize the geocoder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My problem is that when I type in an address (611 Walker or 6510 Westview Dr) it zooms out to the scale of the county and requires you to manually zoom to the address you typed in.&amp;nbsp; Instead of just zooming directly to the location.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried inserting this little ditty "map.centerAndZoom(geom,19)" but I cant seem to find the correct place to place it.&amp;nbsp; I am beginning to wonder if this is just a downfall of using a template.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone know of a way to zoom to a location using the templates?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2012 16:37:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188599#M9303</guid>
      <dc:creator>deleted-user-FYWnb7WVNuhY</dc:creator>
      <dc:date>2012-02-07T16:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom Scale - ArcGIS.com - Basic Viewer Template</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188600#M9304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We have made some changes to how the zoom works for the next release of the template that will determine the 'best fit extent' for the resulting address and zoom to that. Currently, the template uses a hardcoded a zoom level. Here�??s the updated code if you want to try it this in your app. You'll need to replace the existing findLocation and showResults functions in layout.js with these. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;//use the locator to find the input location
 function findLocation() {
&amp;nbsp; var searchText = dojo.byId('searchField').value;
&amp;nbsp; //clear any existing map graphics
&amp;nbsp; map.graphics.clear();
&amp;nbsp; 
&amp;nbsp; var address = {};
&amp;nbsp; address[configOptions.placefinder.singlelinefieldname] = searchText;

&amp;nbsp;&amp;nbsp;&amp;nbsp; var options = {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address:address,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields:["*"]
&amp;nbsp;&amp;nbsp;&amp;nbsp; };
&amp;nbsp; 
&amp;nbsp; locator.addressToLocations(options);

}
//display the location results on the map 
function showResults(candidates) {
&amp;nbsp; var candidate;
&amp;nbsp; var geom;
&amp;nbsp; //hide the info window if displayed
&amp;nbsp; if(map.infoWindow.isShowing){
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.clearFeatures();
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.hide();
&amp;nbsp; }
&amp;nbsp; var zoomExtent;
&amp;nbsp; dojo.every(candidates, function (candidate) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (candidate.score &amp;gt; 80) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geom = candidate.location;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.setTitle(i18n.tools.search.title);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.setContent(candidate.address);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.show(geom);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; zoomExtent = new esri.geometry.Extent(candidate.attributes.West_Lon, candidate.attributes.South_Lat,candidate.attributes.East_Lon, candidate.attributes.North_Lat, new esri.SpatialReference({wkid:4326}));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(zoomExtent.toJson());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false; //break out of loop after one candidate with score greater&amp;nbsp; than 80 is found.
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp; });
&amp;nbsp; if (geom !== undefined) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; //if the extent is constrained check to see if geocode result is within extent.If it is then zoom otherwise don't.
&amp;nbsp;&amp;nbsp;&amp;nbsp; if((configOptions.constrainmapextent === 'true' || configOptions.constrainmapextent === true) &amp;amp;&amp;amp; !webmapExtent.contains(geom)){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.byId('searchField').value = i18n.tools.search.errors.missingLocation;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.hide();
&amp;nbsp;&amp;nbsp;&amp;nbsp; }else{ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.setExtent(esri.geometry.geographicToWebMercator(zoomExtent));
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }else{
&amp;nbsp;&amp;nbsp;&amp;nbsp; //no matches found
&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.byId('searchField').value = i18n.tools.search.errors.missingLocation;
&amp;nbsp; }
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:31:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188600#M9304</guid>
      <dc:creator>MikeMinami</dc:creator>
      <dc:date>2021-12-11T09:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom Scale - ArcGIS.com - Basic Viewer Template</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188601#M9305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Mike,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am also trying to set the zoom level for the locator search.&amp;nbsp; What am I missing?&amp;nbsp; I am utilizing the basic viewer template (2.8 javascript api).&amp;nbsp; Which I think included your code sample.&amp;nbsp; However I am still unable to change the zoom level I even added.&amp;nbsp; if (geom !== undefined) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.centerAndZoom(geom,12); to the layout.js&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know if is probable very simple.&amp;nbsp; help&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Apr 2012 20:08:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188601#M9305</guid>
      <dc:creator>MelissaPrindiville</dc:creator>
      <dc:date>2012-04-11T20:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom Scale - ArcGIS.com - Basic Viewer Template</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188602#M9306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Melissa is your app publicly available? If so can you send us the url so we can check out the changes you've made. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kelly&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Mike,&lt;BR /&gt;&lt;BR /&gt;I am also trying to set the zoom level for the locator search.&amp;nbsp; What am I missing?&amp;nbsp; I am utilizing the basic viewer template (2.8 javascript api).&amp;nbsp; Which I think included your code sample.&amp;nbsp; However I am still unable to change the zoom level I even added.&amp;nbsp; if (geom !== undefined) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.centerAndZoom(geom,12); to the layout.js&lt;BR /&gt;&lt;BR /&gt;I know if is probable very simple.&amp;nbsp; help&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 14:52:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188602#M9306</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2012-04-12T14:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom Scale - ArcGIS.com - Basic Viewer Template</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188603#M9307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't have a public url as of yet.&amp;nbsp; Attached find the layout.js if that would help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 18:04:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188603#M9307</guid>
      <dc:creator>MelissaPrindiville</dc:creator>
      <dc:date>2012-04-12T18:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom Scale - ArcGIS.com - Basic Viewer Template</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188604#M9308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Melissa,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that you use map.centerAndZoom before the line that sets the map's extent to the extent returned from the locator (see bold line). If you want to zoom to a specific level then you could comment out the map.setExtent line and add yours. &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
if (geom !== undefined) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.centerAndZoom(geom,12);

&amp;nbsp;&amp;nbsp;&amp;nbsp; //if the extent is constrained check to see if geocode result is within extent.If it is then zoom otherwise don't.
&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((configOptions.constrainmapextent === 'true' || configOptions.constrainmapextent === true) &amp;amp;&amp;amp; !webmapExtent.contains(geom)) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.byId('searchField').value = i18n.tools.search.errors.missingLocation;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.hide();
&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&amp;nbsp;&amp;nbsp; map.setExtent(esri.geometry.geographicToWebMercator(zoomExtent));&lt;/STRONG&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
} else {
&amp;nbsp;&amp;nbsp;&amp;nbsp; //no matches found
&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.byId('searchField').value = i18n.tools.search.errors.missingLocation;
}
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:31:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188604#M9308</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2021-12-11T09:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom Scale - ArcGIS.com - Basic Viewer Template</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188605#M9309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Awesome.&amp;nbsp; See simple. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp; Thanks for your assistance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2012 15:08:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/zoom-scale-arcgis-com-basic-viewer-template/m-p/188605#M9309</guid>
      <dc:creator>MelissaPrindiville</dc:creator>
      <dc:date>2012-04-13T15:08:34Z</dc:date>
    </item>
  </channel>
</rss>

