<?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: How can I show mutiple address markers on a map and set the proper map scale? in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490305#M11252</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks again, Andy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Awesome.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Jan 2012 18:54:27 GMT</pubDate>
    <dc:creator>FranciscRomano</dc:creator>
    <dc:date>2012-01-27T18:54:27Z</dc:date>
    <item>
      <title>How can I show mutiple address markers on a map and set the proper map scale?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490297#M11244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an Array of address objects and am currently looping through each array element and calling locateTask.addressToLocations() for each.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It works, but it's ugly, lots of moving around and scaling occuring for each address as it's located.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was wondering what the proper way to do this is please and how to set map scale to have all markers in view.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The scaling is done as if for one marker:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private function mapAddressResult(candidates:Array,token:Object=null):void
{
 if(candidates.length &amp;gt; 0)
 {
&amp;nbsp; var addressCandidate:AddressCandidate=candidates[0];
&amp;nbsp; var mapGraphic:Graphic=new Graphic();
&amp;nbsp; mapGraphic.geometry=addressCandidate.location;
&amp;nbsp; mapGraphic.symbol=selectedSymbol;
&amp;nbsp; mapGraphic.toolTip=addressCandidate.address.toString();
&amp;nbsp; mapGraphic.id="graphic";
&amp;nbsp; graphicsLayer.add(mapGraphic);
&amp;nbsp; map.centerAt(addressCandidate.location);
&amp;nbsp; 
&amp;nbsp; // Zoom to an appropriate level
&amp;nbsp; // Note: your tile levels and LOC_NAME might differ...
&amp;nbsp; if (addressCandidate.attributes.Loc_name.search("RoofTop") &amp;gt; 0)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; map.scale=10000;
&amp;nbsp; }
&amp;nbsp; else if (addressCandidate.attributes.Loc_name.search("Address")&amp;gt;0)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; map.scale=10000;
&amp;nbsp; }
&amp;nbsp; else if (addressCandidate.attributes.Loc_name.search("Street")&amp;gt;0)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; map.scale=15000;
&amp;nbsp; }
&amp;nbsp; else if (addressCandidate.attributes.Loc_name.search("Zipcode")&amp;gt;0)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; map.scale=40000;
&amp;nbsp; }
&amp;nbsp; else if (addressCandidate.attributes.Loc_name.search("City")&amp;gt;0)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; map.scale=150000;
&amp;nbsp; }
&amp;nbsp; else
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; map.scale=500000;
&amp;nbsp; }
 }
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That method is called for each of the addresses, hence the re-centering and re-scaling each time one is located.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I do this properly please?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jan 2012 22:38:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490297#M11244</guid>
      <dc:creator>FranciscRomano</dc:creator>
      <dc:date>2012-01-05T22:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show mutiple address markers on a map and set the proper map scale?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490298#M11245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Help! *bump*&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Jan 2012 17:34:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490298#M11245</guid>
      <dc:creator>FranciscRomano</dc:creator>
      <dc:date>2012-01-15T17:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show mutiple address markers on a map and set the proper map scale?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490299#M11246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;private var zoomToExtent:Extent;&lt;BR /&gt;private function doZoom(event:MouseEvent):void&lt;BR /&gt;{&lt;BR /&gt;if (graphicsLayer.numGraphics &amp;gt; 0)&lt;BR /&gt;{&lt;BR /&gt; var arr:Array = new Array();&lt;BR /&gt; for each (var g:Graphic in graphicsLayer.graphicProvider)&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; arr.push(g);&lt;BR /&gt; }&lt;BR /&gt; var ge:Extent = GraphicUtil.getGraphicsExtent(arr);&lt;BR /&gt; if (ge)&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; var dist:Number=1000;&lt;BR /&gt;&amp;nbsp; var graphicsExtent:Extent = new Extent(ge.xmin-dist,ge.ymin-dist,ge.xmax+dist,ge.ymax+dist,map.spatialReference);&lt;BR /&gt;&amp;nbsp; if (graphicsExtent)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; zoomToExtent = graphicsExtent;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; map.extent = graphicsExtent;&lt;BR /&gt;&amp;nbsp; } &lt;BR /&gt; }else&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; var bdist:Number=1000;&lt;BR /&gt;&amp;nbsp; var gr:Graphic = graphicsLayer.graphicProvider[0];&lt;BR /&gt;&amp;nbsp; var pt:MapPoint = gr.geometry as MapPoint;&lt;BR /&gt;&amp;nbsp; var ext:Extent = new Extent(pt.x -bdist,pt.y-bdist,pt.x+bdist,pt.y+bdist,map.spatialReference);&lt;BR /&gt;&amp;nbsp; zoomToExtent=ext;&lt;BR /&gt;&amp;nbsp; map.extent=ext;&lt;BR /&gt; }&lt;BR /&gt; checkEnvelope();&lt;BR /&gt;}&lt;BR /&gt;private function checkEnvelope():void&lt;BR /&gt;{&lt;BR /&gt; if (zoomToExtent.contains(map.extent))&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; map.zoomOut(); &lt;BR /&gt; }&amp;nbsp; &lt;BR /&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically creates an extent for the graphics layer and then sets the map.extent to the new extent.&amp;nbsp; The check envelope is used for viewers that have cached base maps where the zooms are fixed.&amp;nbsp; Let me know, it works well for me.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jan 2012 16:40:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490299#M11246</guid>
      <dc:creator>andrewj_ca</dc:creator>
      <dc:date>2012-01-16T16:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show mutiple address markers on a map and set the proper map scale?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490300#M11247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for your answer, Andrew, much appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Scaling was part of my problem and your solution works nicely.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My other problem is I have an array of addresses that I loop through and for each successfully located address the mapAddressResult() I wrote is called.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a method I can pass multiple addresses at the same time to do this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or should I just add markers as I do, but not set scale and then, once the last address marker is placed, scale using the function you wrote?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Again, thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jan 2012 20:50:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490300#M11247</guid>
      <dc:creator>FranciscRomano</dc:creator>
      <dc:date>2012-01-16T20:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show mutiple address markers on a map and set the proper map scale?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490301#M11248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Help (again)! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 17:58:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490301#M11248</guid>
      <dc:creator>FranciscRomano</dc:creator>
      <dc:date>2012-01-25T17:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show mutiple address markers on a map and set the proper map scale?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490302#M11249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I wouldn't set the scale at all.&amp;nbsp; Loop your results, add them to the map(graphicslayer) and after the loop call my function.&amp;nbsp; This would be far more efficient.&amp;nbsp; Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 18:44:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490302#M11249</guid>
      <dc:creator>andrewj_ca</dc:creator>
      <dc:date>2012-01-27T18:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show mutiple address markers on a map and set the proper map scale?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490303#M11250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OK. So there's no locator that receives an array of addresses.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Looping after each one is still the best way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you, Andy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;By the way, is there an event that gets fired when the map is all set, markers loaded and extent set?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 18:48:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490303#M11250</guid>
      <dc:creator>FranciscRomano</dc:creator>
      <dc:date>2012-01-27T18:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show mutiple address markers on a map and set the proper map scale?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490304#M11251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Since the extent changed is your last task, you can use the map.extentChanged() event.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 18:51:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490304#M11251</guid>
      <dc:creator>andrewj_ca</dc:creator>
      <dc:date>2012-01-27T18:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show mutiple address markers on a map and set the proper map scale?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490305#M11252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks again, Andy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Awesome.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 18:54:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490305#M11252</guid>
      <dc:creator>FranciscRomano</dc:creator>
      <dc:date>2012-01-27T18:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show mutiple address markers on a map and set the proper map scale?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490306#M11253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Happy to help, cheers.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 18:55:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-can-i-show-mutiple-address-markers-on-a-map/m-p/490306#M11253</guid>
      <dc:creator>andrewj_ca</dc:creator>
      <dc:date>2012-01-27T18:55:17Z</dc:date>
    </item>
  </channel>
</rss>

