<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.esri.com/Dev/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ArcGIS Server Blog</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Debug Build: 61120.2)</generator><item><title>Find graphics under a mouse click with the ArcGIS API for JavaScript</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2010/02/08/Find-graphics-under-a-mouse-click-with-the-ArcGIS-API-for-JavaScript.aspx</link><pubDate>Mon, 08 Feb 2010 22:13:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:11385</guid><dc:creator>Kelly</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/11385.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=11385</wfw:commentRss><description>
&lt;p&gt;&lt;a href="http://serverapps.esri.com/javascript_examples/dojofilterdemo.html" title="Dojo filter example"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/2008_server/images/11398/original.aspx" title="Dojo filter example" alt="Dojo filter example" align="right"&gt;&lt;/a&gt;Mapping applications built with the &lt;a href="http://resources.esri.com/arcgisserver/apis/javascript/arcgis/index.cfm?fa=home"&gt;ArcGIS API for
JavaScript&lt;/a&gt; commonly allow users to click or hover over a map and get information about all the features under the current mouse location.
To add this functionality to your application you can listen for the graphics layer's onClick event, however if graphics are stacked on
top of each other, only the top one fires an event. So how do you determine how many graphics are under the point?
&lt;/p&gt;

&lt;p&gt;One approach is to do the following: &lt;/p&gt;

  
&lt;ol&gt;
    
&lt;li&gt;Listen for a click event, perhaps onMouseDown or onClick.&lt;/li&gt;
    
&lt;li&gt;Define a search radius by constructing a new extent around the input point.&lt;/li&gt;
    
&lt;li&gt;Use dojo.Filter to create a new array that contains only the features that are within the search radius.
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Listen for onClick event&lt;/h3&gt;
&lt;p&gt;First, we use dojo.connect to listen for the onClick event. The code snippet below
  connects an event handler to the map's graphics layer that fires whenever a user clicks a graphic.&lt;/p&gt;

 
&lt;pre&gt;dojo.connect(map.graphics,"onClick",identifyFeatures);&lt;/pre&gt;

&lt;p&gt;The event argument provides access to the screen point, map point, and graphic. The map point is the location, in map units,
under the mouse cursor. In the handler function identifyFeatures, call a function that builds a search radius around the input mouse location and
returns the new extent.We'll examine how to build the pointToExtent function in the  next step.&lt;/p&gt;

   
&lt;pre&gt;   function identifyFeatures(evt){&lt;br&gt;    var extentGeom = pointToExtent(map,evt.mapPoint,10);&lt;br&gt;   }&lt;br&gt;   &lt;/pre&gt;
&lt;h3&gt;Construct an extent around the input point&lt;/h3&gt;
&lt;p&gt;In this step, we'll construct an &lt;a href="http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jsapi_start.htm#jsapi/extent.htm"&gt;extent&lt;/a&gt;
around the input map point using the following function. This function uses an input point and tolerance to calculate the extent.&lt;/p&gt;

&lt;pre&gt;function pointToExtent(map, point, toleranceInPixel) {&lt;br&gt;  //calculate map coords represented per pixel&lt;br&gt;  var pixelWidth = map.extent.getWidth() / map.width;&lt;br&gt;  //calculate map coords for tolerance in pixel&lt;br&gt;  var toleraceInMapCoords = toleranceInPixel * pixelWidth;&lt;br&gt;  //calculate &amp;amp; return computed extent&lt;br&gt;  return new esri.geometry.Extent( point.x - toleraceInMapCoords,&lt;br&gt;               point.y - toleraceInMapCoords,&lt;br&gt;               point.x + toleraceInMapCoords,&lt;br&gt;               point.y + toleraceInMapCoords,&lt;br&gt;               map.spatialReference );&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;
&lt;h3&gt;Filter the graphics collection using dojo.filter and display the results&lt;/h3&gt;
&lt;p&gt; &lt;a href="http://api.dojotoolkit.org/jsdoc/1.3.2/dojo.filter"&gt;Dojo.filter&lt;/a&gt; takes an input array and a filtering function
and returns a new array that contains only the items that met the filter requirement.&lt;/p&gt;

&lt;p&gt;Let's look at how to use dojo.Filter to loop through the graphics in our graphics layer and test each graphic against a condition.
In this case, we use extent.contains to perform a spatial query to determine which graphics are within the extent. If a graphic is within the extent, the
function returns true and the graphic is included in the filteredGraphics output array.&lt;/p&gt;

&lt;pre&gt;  var filteredGraphics = dojo.filter(map.graphics.graphics, function(graphic) {&lt;br&gt;    return extentGeom.contains(graphic.geometry);&lt;br&gt;  })&lt;br&gt;&lt;/pre&gt;

&lt;p&gt;Now we have an array that contains only graphics located within the specified tolerance. We can use this array to build a table containing
one row for each graphic under the mouse location. In the snippet below, we construct a table, then use &lt;a href="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/11/Looping-through-graphics-using-the-ArcGIS-API-for-JavaScript.aspx"&gt;dojo.forEach&lt;/a&gt; to
loop through the filteredGraphics array and add a row that displays the city name and population. Finally we build an &lt;a href="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/03/Working-with-info-windows-in-the-ArcGIS-JavaScript-API.aspx"&gt;info window&lt;/a&gt; to display the results.&lt;/p&gt;

&lt;pre&gt;  var content = "";&lt;br&gt;  content = "&amp;lt;i&amp;gt;Total Features: " + filteredGraphics.length + "&amp;lt;\/i&amp;gt;";&lt;br&gt;  content += "&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;City&amp;lt;\/th&amp;gt;&amp;lt;th&amp;gt;Population&amp;lt;\/th&amp;gt;&amp;lt;\/tr&amp;gt;";&lt;br&gt;&lt;br&gt;  //Build a table containing a row for each feature found&lt;br&gt;  dojo.forEach(filteredGraphics,function(row){&lt;br&gt;    content += ""&lt;br&gt;      + row.attributes['CITY_NAME'] +&lt;br&gt;      "&amp;lt;\/td&amp;gt;&amp;lt;td&amp;gt;" + row.attributes['POP1990'] +&lt;br&gt;      "&amp;lt;\/td&amp;gt;&amp;lt;\/tr&amp;gt;";&lt;br&gt;  })&lt;br&gt;  content += "&amp;lt;\/table&amp;gt;";&lt;br&gt;&lt;br&gt; //display the results in an infow window&lt;br&gt; map.infoWindow.setContent(content);&lt;br&gt; map.infoWindow.setTitle("Identify Results");&lt;br&gt; map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;Click &lt;a href="http://serverapps.esri.com/javascript_examples/dojoFilterDemo.html"&gt;here&lt;/a&gt; to view a live sample that uses dojo.filter to display information about all the graphics under the mouse point.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Contributed by Kelly Hutchins of the ArcGIS API for JavaScript development team.&lt;/i&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=11385" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Dojo/default.aspx">Dojo</category></item><item><title>Community voting is open for Developer Summit User Presentations</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2010/01/26/Community-voting-is-open-for-Developer-Summit-User-Presentations.aspx</link><pubDate>Tue, 26 Jan 2010 20:42:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:11112</guid><dc:creator>sterlingdq</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/11112.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=11112</wfw:commentRss><description>&lt;p&gt;We appreciate the many abstracts that were submitted for the 2010 ESRI Developer Summit User Presentations. The deadline for submission has passed, and now it's up to you to &lt;a href="http://esri.force.com/devcon2010/"&gt;vote&lt;/a&gt; on which presentations you'd like to see.&lt;/p&gt;

&lt;p&gt;Voting is open now and will end on February 7. You don't have to be registered for the conference in order to vote, because you may still get a chance to experience the presentations through the published conference proceedings. Voting is open to everyone.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://esri.force.com/devcon2010/"&gt;Vote here&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=11112" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Developer+Summit/default.aspx">Developer Summit</category></item><item><title>Synchronizing map and data grid interaction with the ArcGIS API for JavaScript</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2010/01/15/Synchronizing-map-and-data-grid-interaction-with-the-ArcGIS-API-for-JavaScript.aspx</link><pubDate>Fri, 15 Jan 2010 23:22:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:10299</guid><dc:creator>Kelly</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/10299.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=10299</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://serverapps.esri.com/javascript_examples/StateHighlight.html"&gt;&lt;img title="Highlight row and map graphic" alt="Highlight row and map graphic" align="right" width="318" height="216" src="http://blogs.esri.com/Dev/photos/2008_server/images/10296/original.aspx"&gt;&lt;/a&gt;Several months ago the ArcGIS API for Flex team wrote a &lt;a href="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/02/19/Sychronizing-map-and-datagrid-interaction-with-the-ArcGIS-API-for-Flex.aspx"&gt;post&lt;/a&gt;  showing how to synchronize map and datagrid interaction. In this post, we'll the take a look  at how to accomplish this task using the ArcGIS API for JavaScript.  &lt;/p&gt;&lt;p&gt;In a &lt;a href="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/12/14/Add-a-Zoom-button-to-a-DataGrid.aspx"&gt;previous post&lt;/a&gt; I showed how to display attribute information in a Dojox DataGrid. We'll extend   that sample to add the following functionality:  &lt;/p&gt;&lt;ul&gt;    &lt;li&gt;Hover over map graphics and highlight the associated row&lt;/li&gt;    &lt;li&gt;Hover over rows in the table and highlight the associated graphic&lt;/li&gt;  &lt;/ul&gt;    &lt;h3&gt;Highlighting a row when the user hovers over a graphic&lt;br&gt;&lt;/h3&gt;&lt;p&gt;The graphics layer has several mouse events we can use to determine what end users are doing with the application.OnMouseOverfires when the mouse enters a graphic in the graphics layer. We can listen for this event and, when it fires, loop through the rows in the DataGrid until we find the  row that matches the input graphic's unique identifier.&lt;/p&gt;  &lt;p&gt;Once the row is found we'll use the row's   setOverRow method to highlight the associated graphic row. Our DataGrid contains a large set of items,  so we'll use scrollToRow to programmatically scroll to the highlighted row.&lt;/p&gt;  &lt;pre&gt;  dojo.connect(map.graphics,"onMouseOver",function(evt){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;    selectionLayer.clear();&lt;br&gt;    //Loop through the rows until you find the row with the ObjectID that matches the graphic&lt;br&gt;    //the selected row&lt;br&gt;      for (var i=0, il=grid.rowCount; i&amp;lt;il; i++){&lt;br&gt;        if((grid.getItem(i)) &amp;amp;&amp;amp; grid.getItem(i).ObjectID === evt.graphic.attributes.ObjectID){&lt;br&gt;          grid.rows.setOverRow(i);&lt;br&gt;          grid.scrollToRow(i);&lt;br&gt;          //Add the graphic to the selected graphics layer&lt;br&gt;          var selectedState = new esri.Graphic(evt.graphic.geometry).setAttributes(&lt;br&gt;              evt.graphic.attributes);&lt;br&gt;          selectionLayer.add(selectedState);&lt;br&gt;          break;&lt;br&gt;        }&lt;br&gt;      }&lt;br&gt;  });&lt;br&gt;  &lt;/pre&gt;  If we ran our sample application now, whenever we held the mouse over a graphic, the row in the table would highlight; however,  the default highlight symbol isn't very obvious. To make our highlighted rows stand out more, we can listen  for the DataGrid's onStyleRow event and modify the row's background  color.  &lt;pre&gt;  dojo.connect(grid,"onStyleRow",function(row){&lt;br&gt;    if (row.over) {&lt;br&gt;      row.customStyles+='background-color:#FFFF00;';&lt;br&gt;     }&lt;br&gt;   });&lt;br&gt;  &lt;/pre&gt;  &lt;img src="http://blogs.esri.com/Dev/controlpanel/blogs/highlightrow.bmp"&gt; &lt;p&gt; Next, we'll listen for the graphics layer's onMouseOut event so we can clear the current selection when the  mouse exits the graphic.&lt;/p&gt;  &lt;pre&gt;  dojo.connect(map.graphics,"onMouseOut",function(evt){&lt;br&gt;    selectionLayer.clear();&lt;br&gt;    grid.rows.setOverRow(-1);&lt;br&gt;  });&lt;br&gt;  &lt;/pre&gt;&lt;h3&gt;Highlighting a graphic when the user hovers over a row&lt;br&gt;&lt;/h3&gt;The DataGrid has an event that fires when the mouse hovers over a row. We'll use this event to loop throughthe map's graphics and find the graphic with the unique identifier that matches the input row.&lt;pre&gt;  dojo.connect(grid, "onMouseOverRow", function(evt){&lt;br&gt;    var rowId = grid.getItem(evt.rowIndex).ObjectID;&lt;br&gt;    selectionLayer.clear();&lt;br&gt;    //Loop through the graphics until you find the graphic with the ObjectID that matches&lt;br&gt;    //the selected row.&lt;br&gt;    dojo.some(map.graphics.graphics,function(graphic){&lt;br&gt;      if ((graphic.attributes) &amp;amp;&amp;amp; graphic.attributes.ObjectID === rowId) {&lt;br&gt;      //add the graphic to the selected graphics layer&lt;br&gt;        var selectedState = new esri.Graphic(graphic.geometry).setAttributes(&lt;br&gt;              graphic.attributes);&lt;br&gt;        selectionLayer.add(selectedState);&lt;br&gt;        return true;&lt;br&gt;      }&lt;br&gt;    });&lt;br&gt;  });&lt;br&gt;&lt;/pre&gt;When the mouse leaves the row, we listen for our final event, onMouseOutRow, and when it fires we'll clearthe selection.&lt;pre&gt;  dojo.connect(grid,"onMouseOutRow",function(){&lt;br&gt;    selectionLayer.clear();&lt;br&gt;  });&lt;/pre&gt;&lt;a href="http://serverapps.esri.com/javascript_examples/StateHighlight.html"&gt;&lt;br&gt;View a live sample that synchronizes map graphics and data&lt;/a&gt;&lt;br&gt;&lt;p&gt;&lt;i&gt;Contributed by Kelly Hutchins of the ArcGIS API for JavaScript development team&lt;/i&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=10299" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/JavaScript/default.aspx">JavaScript</category></item><item><title>Present at the 2010 ESRI Developer Summit. Abstracts due soon!</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2010/01/04/Present-at-the-2010-ESRI-Developer-Summit.-Abstracts-due-soon_2100_.aspx</link><pubDate>Mon, 04 Jan 2010 18:05:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:10807</guid><dc:creator>sterlingdq</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/10807.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=10807</wfw:commentRss><description>
&lt;p&gt;The User Presentations track of last year’s ESRI Developer Summit was such a success that we’re opening the floor to you again this year with twice as many slots available. We hope you’ll consider sharing any projects or research you’ve done that would be of interest to other ArcGIS developers. The deadline to submit your abstract is &lt;b&gt;January 15, 2010&lt;/b&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.esri.com/events/devsummit/participate/presentations.html"&gt;Call for Presentations&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://blogs.esri.com/Dev/blogs/arcobjectsdevelopment/archive/2009/09/16/Want-to-present-at-the-2010-ESRI-DevSummit.aspx"&gt;More background on the Developer Summit user presentations and what's new in 2010&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=10807" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Developer+Summit/default.aspx">Developer Summit</category></item><item><title>ArcGIS Online services now available in Google / Bing tiling scheme</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/12/22/ArcGIS-Online-services-now-available-in-Google-_2F00_-Bing-tiling-scheme.aspx</link><pubDate>Tue, 22 Dec 2009 19:47:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:10655</guid><dc:creator>sterlingdq</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/10655.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=10655</wfw:commentRss><description>&lt;P&gt;The ArcGIS Online team &lt;A href="http://blogs.esri.com/Support/blogs/arcgisonline/archive/2009/12/22/arcgis-online-maps-updated-and-migrated-to-google-maps-bing-maps-tiling-scheme.aspx"&gt;announced today&lt;/A&gt; that the ArcGIS Online map services are now available in the same Mercator-based tiling scheme used by Google Maps and Bing Maps. All future updates to ArcGIS Online will occur on the Mercator services.&lt;/P&gt;
&lt;P&gt;The current services (based on the WGS 84 geographic coordinate system) will continue to work without any modifications required to your existing applications; however, these services will eventually be retired.&lt;/P&gt;
&lt;P&gt;This tiling scheme change allows you to overlay your data with ArcGIS Online, Bing Maps, and/or Google Maps without having to build more than one map cache. In &lt;A href="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/20/ArcGIS-Online-moving-to-Google-_2F00_-Bing-tiling-scheme_3A00_-What-does-this-mean-for-you_3F00_.aspx"&gt;this previous post&lt;/A&gt;, you can read more about how the change may affect you and how to design Web map layers that can overlay the new services.&lt;/P&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=10655" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Map+Cache/default.aspx">Map Cache</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/ArcGIS+Online/default.aspx">ArcGIS Online</category></item><item><title>Using Bing Maps with the ArcGIS API for Flex</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/12/21/Using-Bing-Maps-with-the-ArcGIS-API-for-Flex.aspx</link><pubDate>Tue, 22 Dec 2009 01:35:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:10640</guid><dc:creator>sterlingdq</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/10640.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=10640</wfw:commentRss><description>&lt;p&gt;Good-looking basemaps like Bing Maps (formerly known as Microsoft Virtual Earth) are key to providing your Web users with a pleasant user experience and context for your business information. With the ArcGIS API for Flex you can easily access worldwide high quality imagery and street maps from Bing Maps and display information from your own map services on top of them. Bing Maps is also great for supporting the display of advanced GIS analysis from ArcGIS Server services. In this post we will describe some simple steps to add Bing Maps to a Flash-based Web mapping application created with the ArcGIS API for Flex. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Getting Started&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;To add Bing Maps to your ArcGIS Flex applications, it is not required to directly work with Bing Web services. The API provides &lt;a href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/apiref/index.html?com/esri/ags/virtualearth/package-detail.html&amp;amp;com/esri/ags/virtualearth/class-list.html" target="_blank"&gt;classes&lt;/a&gt; to add Bing Maps as basemaps and locate places using the Bing Maps geocoding service. Follow the steps below to get started:&lt;/p&gt;

&lt;ol&gt;
  
&lt;li&gt;Obtain your Bing Maps user name and password from your ArcGIS Server administrator.&lt;/li&gt;
  
&lt;li&gt;Download and configure the "Get Virtual Earth Token" page that matches your development platform.&lt;/li&gt;
  
&lt;li&gt;Specify the "Get Virtual Earth Token" page, or set "serverToken", to access Bing Maps&lt;br&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For more information on these steps refer to the &lt;a href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/help/index.html#ve_gettingstarted.htm?" target="_blank"&gt;Getting Started&lt;/a&gt; documentation.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Adding Bing Maps&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;/b&gt;The &lt;a href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/apiref/index.html?com/esri/ags/virtualearth/VETiledLayer.html&amp;amp;com/esri/ags/virtualearth/class-list.html" target="_blank"&gt;VETiledLayer&lt;/a&gt; class allows you to easily add Bing Maps into your  Flex applications. Below are MXML and ActionScript code to add Bing Maps to your application.&lt;/p&gt;
MXML to use Bing Maps:
&lt;div&gt;
&lt;pre&gt;        &amp;lt;esri:Map&amp;gt;&lt;br&gt;             &amp;lt;esri:VETiledLayer&lt;br&gt;                 environment="production"&lt;br&gt;                 tokenURL=http://myserver:8081/ve/vetoken.jsp&lt;br&gt;                 mapStyle="road"&lt;br&gt;             /&amp;gt;&lt;br&gt;         &amp;lt;/esri:Map&amp;gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;ActionScript to use Bing Maps:&lt;/p&gt;
             &lt;div&gt;
&lt;pre&gt;             var veTiledLayer:VETiledLayer = new VETiledLayer();&lt;br&gt;             veTiledLayer.tokenURL = "http://myserver:8081/ve/vetoken.jsp";&lt;br&gt;             veTiledLayer.environment = "production";&lt;br&gt;             veTiledLayer.mapStyle = VETiledLayer.MAP_STYLE_ROAD;&lt;br&gt;             myMap.addLayer(veTiledLayer);&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now that you have Bing Maps in your map, you can display other information on top. For example you can add the results of a drive time analysis from an ArcGIS Server geoprocessing service. The code flow for the application will look like below. The complete code is &lt;a href="http://serverapps.esri.com/flex/bing_with_arcgis_flex/bing_with_arcgis_flex.txt" target="_blank"&gt;here&lt;/a&gt;. &lt;br&gt;
&lt;/p&gt;

&lt;div&gt;
&lt;pre&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br&gt;&amp;lt;mx:Application&lt;br&gt;    xmlns:mx="http://www.adobe.com/2006/mxml"&lt;br&gt;    xmlns:esri="http://www.esri.com/2008/ags"&amp;gt;&lt;br&gt;	&amp;lt;mx:Script&amp;gt;&lt;br&gt;	&amp;lt;![CDATA[&lt;br&gt;		...&lt;br&gt;		private function computeServiceArea(mapPoint:MapPoint):void&lt;br&gt;		{&lt;br&gt;			//invoke ArcGIS geoprocessing service&lt;br&gt;		}&lt;br&gt;		private function mapClickHandler(event:MapMouseEvent):void&lt;br&gt;		{&lt;br&gt;			computeServiceArea(event.mapPoint);&lt;br&gt;		}&lt;br&gt;	]]&amp;gt;&lt;br&gt;	&amp;lt;/mx:Script&amp;gt;&lt;br&gt;	...&lt;br&gt;	&amp;lt;esri:Geoprocessor id="gp"&lt;br&gt;		url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Network/ESRI_DriveTime_US/GPServer/CreateDriveTimePolygons"/&amp;gt;&lt;br&gt;	&amp;lt;esri:Map id="map" mapClick="mapClickHandler(event)"&amp;gt;&lt;br&gt;		&amp;lt;esri:VETiledLayer environment="production" tokenURL="http://[MYSERVER/ve/vetoken.cfm]"/&amp;gt;&lt;br&gt;		&amp;lt;esri:GraphicsLayer id="graphicsLayer" renderer="{uniqueValueRenderer}"/&amp;gt;&lt;br&gt;	&amp;lt;/esri:Map&amp;gt;&lt;br&gt;&amp;lt;/mx:Application&amp;gt;            &lt;/pre&gt;&lt;pre&gt;&lt;img src="http://blogs.esri.com/Dev/photos/2008_server/images/10641/original.aspx" title="Bing Maps example application" alt="Bing Maps example application" width="396" height="306"&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Make sure when you create a Flex Builder project, you configure it to run from a Web server's virtual directory. If you run the application as a local file, the Bing Maps token handler will not recognize the referrer added in the token handler page.&lt;/p&gt;

&lt;p&gt;You should also know that we are migrating all the ArcGIS Online map services to fit the Bing Maps tiling scheme, so you can combine any layer with Bing Maps. Of course, with the code above you also know how to combine Bing Maps with your own ArcGIS Server services!&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Geocoding with Bing Maps&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The ArcGIS API for Flex exposes Bing Maps geocoding through the &lt;a href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/apiref/index.html?com/esri/ags/virtualearth/VEGeocoder.html&amp;amp;com/esri/ags/virtualearth/class-list.html" target="_blank"&gt;VEGeocoder&lt;/a&gt; class. Below is a code snippet for using Bing Maps geocoding in your application.&lt;/p&gt;

&lt;p&gt;ActionScript to use Bing Maps geocoder:&lt;/p&gt;
&lt;div&gt;
&lt;pre&gt;            var veGeocoder:VEGeocoder = new VEGeocoder();&lt;br&gt;            veGeocoder.environment = "production";&lt;br&gt;            veGeocoder.tokenURL = "http://[MYSERVER/VE/vetoken.jsp]";&lt;br&gt;            var query:String = "380 New York St, CA";&lt;br&gt;            veGeocoder.addressToLocations(query);&lt;br&gt;            veGeocoder.addEventListener(VEGeocoderEvent.ADDRESS_TO_LOCATIONS_COMPLETE,&lt;br&gt;                function (event:VEGeocoderEvent):void{&lt;br&gt;                    var veResult:VEGeocodeResult = event.results[0];&lt;br&gt;                    myMap.extent = WebMercatorUtil.geographicToWebMercator(veResult.bestView) as Extent;&lt;br&gt;                }&lt;br&gt;            );&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Observe from the code above that the ArcGIS API for Flex also has utility methods to convert the coordinates of the geocoding results between the geographic and Web Mercator coordinate systems. The Bing Maps geocoding service always returns the results in geographic coordinates, and you will need to convert them to the appropriate coordinate system of your basemap. &lt;/p&gt;

&lt;p&gt;Click on the links below to view live samples that showcase the use of Bing Maps and the Bing Maps geocoding service. &lt;/p&gt;

&lt;ul&gt;
  
&lt;li&gt;&lt;a href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/samples/index.html?sample=VETiledLayer" target="_blank"&gt;Bing Maps map styles&lt;/a&gt;&lt;/li&gt;
  
&lt;li&gt;&lt;a href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/samples/index.html?sample=VEGeocoder" target="_blank"&gt;Bing Maps geocoder&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To get more information on using Bing Maps in your Flex applications, see &lt;a href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/help/index.html#ve_gettingstarted.htm?" target="_blank"&gt;Getting Started with Bing Maps in the ArcGIS API for Flex&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;i&gt;Contributed by Antony Jayaprakash of the ArcGIS API for Flex development team.&lt;/i&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=10640" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Web+services/default.aspx">Web services</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Flex/default.aspx">Flex</category></item><item><title>Zoom to DataGrid records with the ArcGIS API for JavaScript</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/12/14/Add-a-Zoom-button-to-a-DataGrid.aspx</link><pubDate>Mon, 14 Dec 2009 19:11:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:10298</guid><dc:creator>Kelly</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/10298.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=10298</wfw:commentRss><description>
&lt;p&gt;&lt;a href="http://serverapps.esri.com/javascript_examples/StateZoom.html" title="View an example application"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/2008_server/images/10473/original.aspx" title="State DataGrid with zoom button" alt="State DataGrid with zoom button" align="right" width="366" height="178"&gt;&lt;/a&gt;Recently we &lt;a href="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/12/02/Display-attributes-in-a-Dojox-DataGrid.aspx"&gt;posted&lt;/a&gt; how to display attributes in your ArcGIS JavaScript applications using a Dojo DataGrid. In this post we'll
extend that sample to add a zoom button to each record of the grid. Each button is a dijit (Dojo's name for widget) that lets users zoom to the U.S. state associated with the record. &lt;/p&gt;

&lt;p&gt;Each field in the DataGrid can define a formatter that returns the value to
display in the cell. This value can incorporate HTML and JavaScript, which is the key to allowing you to insert dijits into your DataGrid. &lt;/p&gt;

&lt;p&gt;To add the zoom buttons, modify the DataGrid in markup to add a new field and
define a formatter function that will create the necessary HTML to display a zoom button. Set the unique identifier
  (ObjectID) as the data field so we can find the associated graphic on the map.&lt;/p&gt;

&lt;pre&gt;&amp;lt;th field="ObjectID" formatter="makeZoomButton" width="18px"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;img alt="+" src="zoom.png"/&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;/th&amp;gt;&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;The makeZoomButton function creates a new button, defines button properties like width,
height and a display image and associates a function with the onClick event.&lt;/p&gt;

&lt;pre&gt;  function makeZoomButton(id){&lt;br&gt;      var zBtn = "&amp;lt;div dojoType='dijit.form.Button'&amp;gt;&amp;lt;img src='zoom.png'";&lt;br&gt;      zBtn = zBtn + " width='18' height='18'";&lt;br&gt;      zBtn = zBtn + " onClick=\"zoomRow('"+id+"')\"&amp;gt;&amp;lt;/div&amp;gt;";&lt;br&gt;      return zBtn;&lt;br&gt;    }&lt;/pre&gt;
&lt;p&gt;The onClick event calls the zoomRow function which loops through the graphics in the map,
 finds the graphic that matches the selected row, then zooms.&lt;/p&gt;

&lt;pre&gt;    function zoomRow(id){&lt;br&gt;      selectionLayer.clear();&lt;br&gt;      dojo.some(map.graphics.graphics,function(graphic){&lt;br&gt;        if (graphic.attributes.ObjectID.toString() === id) {&lt;br&gt;          var selectedState = new esri.Graphic(graphic.geometry).setAttributes(&lt;br&gt;              graphic.attributes);&lt;br&gt;          selectionLayer.add(selectedState);&lt;br&gt;          var stateExtent = selectedState.geometry.getExtent().expand(5.0);&lt;br&gt;          map.setExtent(stateExtent);&lt;br&gt;          return true;&lt;br&gt;        }&lt;br&gt;      });&lt;br&gt;&lt;/pre&gt;
A few weeks ago we covered &lt;a href="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/11/Looping-through-graphics-using-the-ArcGIS-API-for-JavaScript.aspx"&gt; using Dojo.forEach&lt;/a&gt;, a Dojo implementation of one of the JavaScript array extras. In the snippet above we use another array extra &lt;a href="http://api.dojotoolkit.org/jsdoc/1.3.2/dojo.some"&gt;
Dojo.some&lt;/a&gt;. Dojo.some checks each item in the array and returns true if some of the items return true from the callback function.
In this example we use Dojo.some to break from a loop once we find an item that fits our criteria. In this case, our criteria is finding a graphic that matches the selected row in the DataGrid.
&lt;p&gt;Click &lt;a href="http://serverapps.esri.com/javascript_examples/StateZoom.html" title="Zoom to State"&gt;here&lt;/a&gt; to view a live sample that displays attributes in a zoomable DataGrid&lt;/p&gt;

&lt;p&gt;&lt;a href="http://serverapps.esri.com/javascript_examples/StateZoom.html" title="View an example application"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/2008_server/images/10474/original.aspx" title="Example application with DataGrid zoom" alt="Example application with DataGrid zoom" width="440" height="220"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;i&gt;Contributed by Kelly Hutchins of the ArcGIS JavaScript API development team.&lt;/i&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=10298" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Dojo/default.aspx">Dojo</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/dijits/default.aspx">dijits</category></item><item><title>White paper gives tips for 9.3.1 cached map service performance on Apache HTTP Server</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/12/08/White-paper-gives-tips-for-9.3.1-cached-map-service-performance-on-Apache-HTTP-Server.aspx</link><pubDate>Tue, 08 Dec 2009 18:28:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:10356</guid><dc:creator>sterlingdq</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/10356.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=10356</wfw:commentRss><description>
&lt;p&gt;We've just published &lt;a href="http://www.esri.com/library/whitepapers/pdfs/performance-and-throughput-tips.pdf"&gt;a new paper&lt;/a&gt; that offers some tips for boosting performance and throughput of cached map services with Apache's HTTP Web Server. By now, we all understand that the caching of static ArcGIS Server maps provides the fastest delivery of maps over the Web and to the enterprise. However, there are ways to take your throughput a step further by tuning the Web server for better load balancing and cache handling. The paper also discusses the results of some test scenarios that involved some of these simple tuning steps.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="http://www.esri.com/library/whitepapers/pdfs/performance-and-throughput-tips.pdf"&gt;Performance and Throughput Tips for ArcGIS Server 9.3.1 Cached Map Services and the Apache HTTP Server&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;i&gt;Contributed by Eric Bader, ESRI Product Manager for Java/Linux/Solaris.&lt;/i&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=10356" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Map+Cache/default.aspx">Map Cache</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Java/default.aspx">Java</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Performance/default.aspx">Performance</category></item><item><title>Displaying attributes in a DojoX DataGrid</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/12/02/Display-attributes-in-a-Dojox-DataGrid.aspx</link><pubDate>Thu, 03 Dec 2009 00:40:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:10259</guid><dc:creator>Kelly</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/10259.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=10259</wfw:commentRss><description>&lt;p&gt;In this post we'll show how to populate a DojoX DataGrid with attribute information from the results of a query task. DojoX contains extensions to the Dojo toolkit. Many of these extensions are experimental, but the DojoX library also includes more mature extensions like the &lt;a href="http://docs.dojocampus.org/dojox/grid/DataGrid"&gt;DataGrid&lt;/a&gt;.&lt;/p&gt;&lt;p&gt; &lt;a href="http://serverapps.esri.com/javascript_examples/PopulateDataGridDemo.html"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/2008_server/images/10277/original.aspx" style="width:284px;height:248px;" align="middle"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Create the grid&lt;/h3&gt;
&lt;p&gt;Here's an example of a DataGrid created in markup. Note that the markup is a standard HTML table with the addition of a dojoType attribute that is set to "dojox.grid.DataGrid". In this example, we don't want the grid rows to be selectable so let's set the &lt;a href="http://docs.dojocampus.org/dojox/grid/DataGrid#working-with-selections"&gt;selectionMode&lt;/a&gt; to none. &lt;/p&gt;&lt;pre&gt;&amp;nbsp;&amp;lt;table dojotype="dojox.grid.DataGrid" jsid="grid" id="grid"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selectionMode="none"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;thead&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;tr&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;th field="STATE_NAME" width="100px"&amp;gt;State&amp;lt;/th&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;th field="POP2000" width="100%"&amp;gt;Population&amp;lt;/th&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/tr&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/thead&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/table&amp;gt;&lt;br&gt;&lt;/pre&gt;
&lt;h3&gt;Format the data&lt;/h3&gt;
&lt;p&gt;In order to display the attributes in a DataGrid, they need to be in a particular format defined by a data store. A data store reads data and formats it as a collection of name/value items. Dojo.data has several specialized data stores for working with different data formats. In this example, we'll use the &lt;a href="http://docs.dojocampus.org/dojo/data/ItemFileReadStore"&gt;dojo.data.ItemFileReadStore,&lt;/a&gt; a read-only store designed for working with JSON data.&lt;/p&gt;
&lt;p&gt;Here's an example of the format for ItemFileReadStore: &lt;/p&gt;&lt;pre&gt;{ identifier: identifier field,&lt;br&gt;  label:label field,&lt;br&gt;  Items: [&lt;br&gt;    {field1: value1 ,field2:value2},&lt;br&gt;    {field1: value1, field2:value2}&lt;br&gt;  ]&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;Identifier is an optional item and specifies a field in the data source that contains unique values. Label is also optional and defines an attribute that contains a user-friendly name for the item. Items is required and is an array of name/value JavaScript objects that contain the data to display. 
&lt;p&gt;Let's look at how to get our query results into the format required by ItemFileReadStore. Our sample application queries a United States Census data service on load. Once the query is finished, it returns a record for each state containing the state name, population and a unique identifier. We need to build an array containing the field name and values for each item in this result collection. One way to do this is to create a new array, then loop through the items and push each value into the array.&lt;/p&gt;&lt;pre&gt; dojo.connect(queryTask,"onComplete",function(featureSet){&lt;br&gt;  //build an array of attributes&lt;br&gt;  var items=[];&lt;br&gt;  for (var i=0, il=featureSet.features.length;i &amp;lt; il;i++){&lt;br&gt;    items.push(featureSet.features[i].attributes);&lt;br&gt;  }&lt;br&gt; }})&lt;br&gt; &lt;/pre&gt;
&lt;p&gt;An alternative approach is to use dojo.map to build the name/value array of attributes. Dojo.map is Dojo's implementation of the JavaScript array extra array.map. Dojo.map creates a new array of elements based on the return value from the callback function. We covered another array extra, dojo.forEach, in an earlier &lt;a href="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/11/Looping-through-graphics-using-the-ArcGIS-API-for-JavaScript.aspx"&gt;post&lt;/a&gt; and discussed the benefits of not having to create and maintain a loop counter. The same benefit applies here.&lt;a href="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/11/Looping-through-graphics-using-the-ArcGIS-API-for-JavaScript.aspx"&gt;&lt;/a&gt; In our sample application we'll use the dojo.map approach:&lt;/p&gt;&lt;pre&gt;dojo.connect(queryTask,"onComplete",function(featureSet){&lt;br&gt;  var items = dojo.map(featureSet.features,function(feature){&lt;br&gt;    return feature.attributes;&lt;br&gt;  });&lt;br&gt;})&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;The attribute array we created in the last step is in the proper format, so let's assign that to the items. The ObjectID field in the data source contains unique values, so we'll specify it as the identifier.&lt;/p&gt;&lt;pre&gt;var data = {&lt;br&gt;    identifier:"ObjectID",&lt;br&gt;    items:items};&lt;br&gt;&lt;/pre&gt;
&lt;h3&gt;Populate the grid with attributes&lt;/h3&gt;
&lt;p&gt;In this step, we create a new ItemFileReadStore and bind the store to the DataGrid. Optionally, you can use setSortIndex to sort the data based on one of the attribute values. To sort a field, use the grid's setSortIndex method and pass in an integer for the sort field and a boolean value that represents the sort direction. The field integer is determined by the order the fields are specified in the HTML markup. In this case the STATE_NAME is the second field, but since it's a 0-based value, you'll specify 1 for the sort index.&lt;/p&gt;&lt;pre&gt;  store = new dojo.data.ItemFileReadStore({data:data});&lt;br&gt;  grid.setStore(store);&lt;br&gt;  grid.setSortIndex(1,"true"); //sort on the state name&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;If you plan on including a DataGrid in your JavaScript project, stay tuned. In an upcoming post, we'll show how to add a zoom button to each row of the DataGrid. &lt;/p&gt;
&lt;p&gt;Click &lt;a href="http://serverapps.esri.com/javascript_examples/PopulateDataGridDemo.html"&gt;here&lt;/a&gt; to view a live sample that displays attributes in a DataGrid&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Contributed by Kelly Hutchins of the ArcGIS API for JavaScript development team&lt;/i&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=10259" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Tasks/default.aspx">Tasks</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Dojo/default.aspx">Dojo</category></item><item><title>ArcGIS Online moving to Google / Bing tiling scheme: What does this mean for you?</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/20/ArcGIS-Online-moving-to-Google-_2F00_-Bing-tiling-scheme_3A00_-What-does-this-mean-for-you_3F00_.aspx</link><pubDate>Fri, 20 Nov 2009 21:42:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:10041</guid><dc:creator>sterlingdq</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/10041.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=10041</wfw:commentRss><description>&lt;p&gt;Earlier this year ESRI announced that &lt;a href="http://resources.esri.com/arcgisonlineservices/" title="ArcGIS Online Services"&gt;ArcGIS Online services&lt;/a&gt; will be migrating to the Mercator-based tiling scheme used by Google Maps and Bing Maps. The ArcGIS Online engineers have been busy caching tiles for months in anticipation of this switch, which is anticipated to occur by the end of this year. This post is about how the change may affect you. At the end of the post we also provide steps on how to make the change for your services.&lt;/p&gt;
&lt;h3&gt;Why a tiling scheme change?&lt;/h3&gt;
&lt;p&gt;Since the release of ArcGIS Online three years ago, the 2D services have used the WGS 1984 geographic coordinate system and a 512 x 512 pixel tile size. Google and Bing, in contrast, use a modified Mercator projection and a 256 x 256 tile size. The scale sets used by both tiling schemes are similar, but not equivalent.&lt;/p&gt;
&lt;p&gt;Why didn’t ArcGIS Online originally choose to match Google and Bing? Interestingly enough, the first ArcGIS Online services were designed in 3D for viewing in ArcGlobe and ArcGIS Explorer. Without getting into the technical details, it’s enough to say that the coordinate system and scales used in the 2D ArcGIS Online tiling scheme have their roots in the ESRI globe technology for which ArcGIS Online was originally built.&lt;/p&gt;
&lt;p&gt;With the broad uptake of the ArcGIS Web APIs, the 2D ArcGIS Online services have become very widely used. Some organizations struggle with choosing either the ArcGIS Online tiling scheme to match their ESRI software stack, or the Google / Bing tiling scheme to match a better-known standard. With a unified tiling scheme for the three services, the decision gets a lot easier.&lt;/p&gt;
&lt;p&gt;A few organizations are required to support mashups with both ArcGIS Online and Google Maps or Bing Maps. After the ArcGIS Online tiling scheme change, these organizations will no longer have to maintain two caches.&lt;/p&gt;
&lt;h3&gt;What does this mean for you?&lt;/h3&gt;
&lt;p&gt;If you are getting ready to create a very large cache to overlay ArcGIS Online, it may be best to create the cache in the Google / Bing tiling scheme, anticipating the change.&lt;/p&gt; 
&lt;p&gt;If you are not able to re-create your cache at this time, the old services will remain available for a minimum of six months. They will be offered “as is” and will not receive any further data or cartography updates.&lt;/p&gt;
&lt;h3&gt;Advantages of switching to the Google / Bing tiling scheme&lt;/h3&gt;
&lt;p&gt;The biggest advantage of switching to the Google / Bing tiling scheme is standardization. This tiling scheme is well-known and widely used. Whether you love the Mercator projection or hate it, it is now customary in Web maps designed for mass consumption. In the end, simplicity of math (you can fit the world on a square at the smallest scale) determined the way most Internet users expect to see the world.&lt;/p&gt;
&lt;p&gt;There are some subtle performance advantages to the Google / Bing tiling scheme. Because the tiles are only 256 x 256 pixels, less tile area falls outside the periphery of the map. This means you have to send less data across the wire. The smaller tiles also enhance the perception of the map loading faster, compared with waiting for the 512 x 512 “chunks” of map to appear.&lt;/p&gt;  
&lt;h3&gt;Challenges associated with the Google / Bing tiling scheme&lt;/h3&gt;
&lt;p&gt;If you re-create your caches in the Google / Bing tiling scheme, you need to anticipate a few issues. First, because the tiles are 256 x 256, you’ll be creating roughly four times as many tiles as you had previously in your ArcGIS Online cache. The larger number of files in your cache will increase cache copying time. The smaller tile size also means you have to send more files to the client during a map request.&lt;/p&gt;
&lt;p&gt;Your cache size on disk will probably also increase. Some of the 256 x 256 tiles can get very small in size if they contain few features; much smaller than the 4K default minimum cluster size on Windows. Some organizations have saved space by storing their caches on disks or partitions formatted with a smaller minimum cluster size, such as 1K.  This reduces the discrepancy between “Size” and “Size on disk”.&lt;/p&gt;
&lt;p&gt;Finally, the Mercator projection is going to stretch your map vertically, especially if you work with extreme latitudes. Besides affecting the appearance of the map, this distortion may cause you to create many more tiles than you might otherwise expect. At these latitudes, it is critical to target your cache at just the scales and geographies that you need. You may want to enable on-demand caching for the most isolated regions. The distortion introduced by the Mercator projection also means that before you measure a feature such as a user-drawn polygon, you should project the feature into a more locally-tailored coordinate system such as UTM or State Plane.&lt;/p&gt;

&lt;h3&gt;How do you create a cache to match the Mercator-based ArcGIS Online services?&lt;/h3&gt;
&lt;p&gt;Here’s the workflow for caching a map to match the Mercator-based ArcGIS Online services:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Open your source map document in ArcMap and set your data frame coordinate system to &lt;b&gt;WGS 1984 Web Mercator&lt;/b&gt;. You don’t have to re-project the source data, although this can make caching go faster. Some people even create a one-way replica of their geodatabase in the WGS 1984 Web Mercator coordinate system and use that replica just for caching.&lt;/li&gt;
&lt;li&gt;Publish a map service.&lt;/li&gt;
&lt;li&gt;Open the &lt;i&gt;Service Properties&lt;/i&gt; and click the &lt;b&gt;Caching&lt;/b&gt; tab. Choose to draw the map service &lt;b&gt;Using tiles from a cache you will define below&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;b&gt;Load tiling scheme from&lt;/b&gt; and select &lt;b&gt;Google Maps / Microsoft Virtual Earth&lt;/b&gt;. Once the scales load, do not add or remove scales or change the tile size.&lt;/li&gt;
&lt;li&gt;Create tiles for just a small area of your map, using a feature class to constrain the caching extent if necessary.&lt;/li&gt;
&lt;li&gt;Test your new cache. There are already a few new ArcGIS Online services that use the Google / Bing tiling scheme, such as the &lt;a href="http://resources.esri.com/arcgisonlineservices/index.cfm?fa=content_detail&amp;amp;contentID=5B7E7247-1422-2418-344DF7D053152D36"&gt;World Topographic Map&lt;/a&gt;. Build a simple test application with these maps to evaluate how your cache overlays with ArcGIS Online in the Mercator projection. If your data doesn’t align, see the alternate steps below for creating a cache in WGS 1984 Web Mercator (Auxiliary Sphere).&lt;/li&gt;
&lt;li&gt;Once everything looks okay, open the caching tools again and create all the tiles for your cache.&lt;/li&gt;&lt;/ol&gt;
&lt;h3&gt;Exceptions and Web Mercator (Auxiliary Sphere)&lt;/h3&gt;

&lt;p&gt;There are a few scenarios where you will have to follow some alternate steps to get your caches to overlay correctly with the Mercator-based ArcGIS Online services. The conditions are:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;You’re overlaying a cache with ArcGIS Online in the Web ADF  &lt;b&gt;OR&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Your data did not align correctly when building a test cache with the above steps. This is most often because your source data uses a datum other than WGS 1984 or NAD 83&lt;/li&gt;&lt;/ul&gt;  
&lt;p&gt;In the above two scenarios, you need to publish your cache using the WGS 1984 Web Mercator (Auxiliary Sphere) coordinate system which is the exact coordinate system used by ArcGIS Online. The Web ADF requires an exact coordinate system match for cache overlays. Also, this coordinate system makes it easier to perform some datum transformations.&lt;/p&gt; 
&lt;ol&gt;&lt;li&gt;Open your source map document in ArcMap and set your data frame coordinate system to &lt;b&gt;WGS 1984 Web Mercator (Auxiliary Sphere)&lt;/b&gt;.  While you are doing this, apply any datum transformations to WGS 1984 that you require.&lt;/li&gt;
&lt;li&gt;Follow the steps in &lt;a href="http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&amp;amp;d=37329"&gt;ESRI Knowledge Base Article 37329&lt;/a&gt; to create a cache for the service.&lt;/li&gt;&lt;/ol&gt; 
&lt;p&gt;&lt;a href="http://resources.esri.com/help/9.3/arcgisonline/about/start.htm#migrating_tiling.htm#" title="Migrating map tiling schemes"&gt;Migrating map tiling schemes&lt;/a&gt; in the ArcGIS Online Help has more details about the switch and the WGS 1984 Web Mercator (Auxiliary Sphere) coordinate system used above.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Contributed by Sterling Quinn of the ArcGIS Server development team.&lt;/i&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=10041" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Map+Cache/default.aspx">Map Cache</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/ArcGIS+Online/default.aspx">ArcGIS Online</category></item><item><title>Looping through graphics using the ArcGIS API for JavaScript</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/11/Looping-through-graphics-using-the-ArcGIS-API-for-JavaScript.aspx</link><pubDate>Wed, 11 Nov 2009 17:27:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:9827</guid><dc:creator>Kelly</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/9827.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=9827</wfw:commentRss><description>&lt;P&gt;When working with the&amp;nbsp;&lt;A href="http://resources.esri.com/arcgisserver/apis/javascript/arcgis/index.cfm?fa=home"&gt;ArcGIS API for JavaScript&lt;/A&gt;&amp;nbsp;you'll often find yourself looping through arrays, like the collection of graphics stored in a graphics layer or the results of a QueryTask. In this post we'll explore two approaches for looping through arrays; using a standard for loop and working with a dojo implementation of one of the JavaScript Array Extras.&lt;/P&gt;
&lt;H3&gt;For Loop&lt;/H3&gt;
&lt;P&gt;First lets look at using a for loop to add query task results to a map. The results of QueryTask are returned as an array of Graphic features so we can use a for loop to iterate through the task results and add each graphic to the map.&lt;/P&gt;&lt;PRE&gt; dojo.connect(queryTask,"onComplete",function(featureSet){&lt;BR&gt;   for(var i=0; i &amp;lt; featureSet.features.length; i++){&lt;BR&gt;     map.graphics.add(featureSet.features[i]);&lt;BR&gt;   })&lt;/PRE&gt;
&lt;P&gt;We can optimize the code a bit by storing the length of the array in a variable. Then the length of the array doesn't need to be recalculated on each loop. The stored length (il) is just compared to the value of the counter(i).&lt;/P&gt;&lt;PRE&gt; for (var i=0; il = featureSet.features.length; i &amp;lt; il; i++){&lt;BR&gt;&lt;/PRE&gt;
&lt;H3&gt;JavaScript Array Extras&lt;/H3&gt;
&lt;P&gt;The JavaScript array extras are useful functions for working with arrays and are part of&amp;nbsp;&lt;A href="http://www.ecma-international.org/news/PressReleases/PR_Ecma_finalises_major_revision_of_ECMAScript.htm"&gt;ECMAScript 5th Edition,&lt;/A&gt;&amp;nbsp;the next revision of the standards on which JavaScript is based. The revised standard is still under development so not all browsers support this functionality. Thankfully Dojo has implemented similar functions as part of&amp;nbsp;&lt;A href="http://dojotoolkit.org/projects/core"&gt;Dojo Core&lt;/A&gt;&amp;nbsp;so we can take advantage of one of the array extras,&amp;nbsp;&lt;A class="" href="http://docs.dojocampus.org/dojo/forEach"&gt;dojo.forEach&lt;/A&gt;, to simplify the process of looping through an array of graphics. Dojo.forEach runs a function on each item in the array.&lt;/P&gt;&lt;PRE&gt; dojo.connect(queryTask,"onComplete",function(featureSet){&lt;BR&gt;   dojo.forEach (featureSet.features, function(feature) {&lt;BR&gt;     map.graphics.add(feature);&lt;BR&gt;   });&lt;BR&gt; });&lt;/PRE&gt;
&lt;P&gt;Note that we no longer need the counter and array length variable which makes the code easier to read and can help avoid the following problems:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://en.wikipedia.org/wiki/Off-by-one_error"&gt;Off-by-one errors&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Overwriting a global variable by forgetting to declare the loop counter as a local variable using the var keyword.&lt;/LI&gt;&lt;/UL&gt;If you do need access to the iterator you can specify an additional argument to the function. This argument provides access to the current position in the array. &lt;PRE&gt; dojo.forEach(featureSet.features,function(feature,index){&lt;BR&gt;   //do something with the index here&lt;/PRE&gt;&lt;PRE&gt; }&lt;BR&gt;&lt;/PRE&gt;
&lt;H3&gt;Links&lt;/H3&gt;
&lt;UL&gt;
&lt;LI&gt;Click&amp;nbsp;&lt;A href="http://serverapps.esri.com/javascript_examples/UsingDojoForEach.html"&gt;here&lt;/A&gt;&amp;nbsp;to view a live sample that uses dojo.forEach to add graphics to a map.&lt;/LI&gt;
&lt;LI&gt;Information from&amp;nbsp;&lt;A href="http://docs.dojocampus.org/quickstart/arrays?action=show&amp;amp;redirect=dojo/_base/array"&gt;Dojo&lt;/A&gt;&amp;nbsp;on working with array utilities&lt;/LI&gt;
&lt;LI&gt;Details on&amp;nbsp;&lt;A href="http://en.wikipedia.org/wiki/ECMAScript"&gt;ECMAScript&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;I&gt;Contributed by Kelly Hutchins of the ArcGIS JavaScript API development team&lt;/I&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=9827" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Dojo/default.aspx">Dojo</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Graphics/default.aspx">Graphics</category></item><item><title>ArcGIS API for Flex: Version 1.3 released today</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/06/ArcGIS-API-for-Flex_3A00_-Version-1.3-released-today.aspx</link><pubDate>Fri, 06 Nov 2009 18:00:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:9666</guid><dc:creator>sterlingdq</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/9666.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=9666</wfw:commentRss><description>&lt;P&gt;It’s been just over one year since we released the first version of the ArcGIS API for Flex. Since then we’ve seen an amazing interest in our Flex API. Many users have created great web applications with the API, and the &lt;A href="http://forums.esri.com/forums.asp?c=158&amp;amp;s=2421#2421"&gt;Flex forum&lt;/A&gt; is now the most active of all the ArcGIS Server forums. &lt;/P&gt;
&lt;P&gt;Today we are pleased to announce the release of &lt;A href="http://resources.esri.com/arcgisserver/apis/flex/"&gt;ArcGIS API for Flex 1.3&lt;/A&gt;. This API release is a minor release but has several useful "goodies". &lt;/P&gt;
&lt;P&gt;Here’s a short summary of what’s new in version 1.3: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Support for Adobe’s Flex 3.4 SDK. The older versions 3.0 thru 3.3 are still supported.&lt;/LI&gt;
&lt;LI&gt;Additional styling options for &lt;A href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/apiref/index.html?com/esri/ags/controls/infoClasses/InfoContainer.html&amp;amp;com/esri/ags/controls/infoClasses/class-list.html"&gt;InfoContainer&lt;/A&gt; (used by InfoWindow and InfoSymbol).&lt;/LI&gt;
&lt;LI&gt;More miscellaneous API improvements and bug fixes.&lt;/LI&gt;
&lt;LI&gt;Well-known ID 102100 (WGS_1984_Web_Mercator_Auxiliary_Sphere) is now a supported projection for Web Mercator-based overlays (including Bing Maps). It is now also used in WebMercatorUtil for projecting coordinates between Geographic and Web Mercator.&lt;/LI&gt;
&lt;LI&gt;New and updated &lt;A href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/samples/index.html"&gt;samples&lt;/A&gt;.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Please read the more complete list of 1.3 API changes in the &lt;A href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/help/index.html#whats_new.htm"&gt;What's New&lt;/A&gt; page in our Resource Center. &lt;/P&gt;
&lt;P&gt;&lt;I&gt;Contributed by Bjorn Svensson of the ArcGIS API for Flex development team&lt;/I&gt;&lt;/P&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=9666" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Flex/default.aspx">Flex</category></item><item><title>Working with info windows in the ArcGIS JavaScript API</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/03/Working-with-info-windows-in-the-ArcGIS-JavaScript-API.aspx</link><pubDate>Tue, 03 Nov 2009 20:11:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:9607</guid><dc:creator>sterlingdq</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/9607.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=9607</wfw:commentRss><description>&lt;p&gt;An easy way to add interactivity to your ArcGIS JavaScript applications is through info windows that display information in response to a user action. From working with other APIs, you might know info windows as "balloons", "map tips", "callouts", or "popups". The concept is the same: the user clicks or hovers over a location on the map and sees HTML-based information about that particular location.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://blogs.esri.com/Dev/photos/2008_server/images/9608/original.aspx" title="Basic info window" alt="Basic info window" width="222" height="174"&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;How does an info window work in the ArcGIS JavaScript API?
&lt;/h3&gt;
&lt;p&gt;In the ArcGIS JavaScript API, the Map has an &lt;a href="http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jsapi/infowindow.htm"&gt;InfoWindow&lt;/a&gt; that can be shown or hidden in response to events.
&lt;/p&gt;

&lt;p&gt;Every info window has a title and content. The title is the bold text that appears at the top of the info window. The content is the HTML that appears below. When you work with info windows, you’ll frequently call methods to set the title and content.
&lt;/p&gt;

&lt;p&gt;The default event when a graphic is clicked is to show an info window. However, in order for this to happen, you need to have defined an &lt;a href="http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jsapi/infotemplate.htm"&gt;InfoTemplate&lt;/a&gt; for the graphic. The InfoTemplate specifies the title and content that should be used in any info windows that result from clicking the graphics. 
&lt;/p&gt;

&lt;p&gt;You can use the notation ${&amp;lt;FIELD&amp;gt;} to pull attributes directly into an info template.
&lt;/p&gt;

&lt;pre&gt;var infoTemplate = new esri.InfoTemplate();&lt;br&gt;infoTemplate.setTitle("${NAME}");&lt;br&gt;infoTemplate.setContent("&amp;lt;b&amp;gt;2000 Population: &amp;lt;/b&amp;gt;${POP2000}&amp;lt;br/&amp;gt;"&lt;br&gt;        + "&amp;lt;b&amp;gt;2000 Population per Sq. Mi.: &amp;lt;/b&amp;gt;${POP00_SQMI}&amp;lt;br/&amp;gt;"&lt;br&gt;        + "&amp;lt;b&amp;gt;2007 Population: &amp;lt;/b&amp;gt;${POP2007}&amp;lt;br/&amp;gt;"&lt;br&gt;        + "&amp;lt;b&amp;gt;2007 Population per Sq. Mi.: &amp;lt;/b&amp;gt;${POP07_SQMI}");&lt;/pre&gt;
		
&lt;p&gt;This code would create an info window similar to what you see below.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://blogs.esri.com/Dev/photos/2008_server/images/9609/original.aspx" title="Info window with attributes" alt="Info window with attributes" width="232" height="175"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;You can handle a graphics layer’s onClick event yourself to show an info window. This can be useful if you need to use JavaScript in some way to construct what you put in the info window. The following function does some math to calculate the population density when a user clicks the graphics layer. The population density is then reported through an info window using the Map.infoWindow.setTitle() and Map.infoWindow.setContent() methods.
&lt;/p&gt;

&lt;pre&gt;dojo.connect(myGraphicsLayer, "onClick", function(evt) {&lt;br&gt;  var graphicAttributes = evt.graphic.attributes;&lt;br&gt;  var title = graphicAttributes.NAME;&lt;br&gt;  var populationDensity = graphicAttributes.POP2007 / graphicAttributes.SQMI;&lt;br&gt;  var content = "The population density in 2007 is &amp;lt;i&amp;gt;" + populationDensity.toFixed(2); + "&amp;lt;/i&amp;gt;.";&lt;br&gt;  map.infoWindow.setTitle(title);&lt;br&gt;  map.infoWindow.setContent(content);&lt;br&gt;  map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));&lt;br&gt;});&lt;/pre&gt;

&lt;p&gt;These Map.infoWindow.setTitle() and Map.infoWindow.setContent methods are also handy if you want to show an info window in response to a query or some other action that doesn’t involve a graphic. Here’s a function designed to show an info window with lat/lon coordinates when the user clicks anywhere on the map.
&lt;/p&gt;

&lt;pre&gt;dojo.connect(map, "onClick", addPoint);&lt;br&gt;function addPoint(evt) {&lt;br&gt;  map.infoWindow.setTitle("Coordinates");&lt;br&gt;  map.infoWindow.setContent("lat/lon : " + evt.mapPoint.y + ", " + evt.mapPoint.x);&lt;br&gt;  map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));&lt;br&gt;}&lt;/pre&gt;
&lt;h3&gt;What can you do with info windows?&lt;/h3&gt;

&lt;p&gt;You can put almost anything in an info window because it displays HTML. Images, hyperlinks, tables, dynamically rendered charts, and any other type of element that can be requested or created with HTML can be placed in an info window.
&lt;/p&gt;

&lt;p&gt;You can take advantage of Dojo libraries to enhance your info windows. This picture shows information organized in a Dojo &lt;a href="http://docs.dojocampus.org/dijit/layout/TabContainer"&gt;TabContainer&lt;/a&gt; in the info window. 
&lt;/p&gt;

&lt;p&gt;&lt;img src="http://blogs.esri.com/Dev/photos/2008_server/images/9610/original.aspx" title="Info window with TabContainer" alt="Info window with TabContainer" width="312" height="182"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Here’s a chart dynamically constructed for an InfoWindow using the &lt;a href="http://docs.dojocampus.org/dojox/charting"&gt;Dojo charting library&lt;/a&gt;:
&lt;/p&gt;

&lt;p&gt;&lt;img src="http://blogs.esri.com/Dev/photos/2008_server/images/9611/original.aspx" title="Info window with chart" alt="Info window with chart" width="311" height="228"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Just because you can put something in an info window doesn’t always mean that you should. The &lt;a href="http://docs.dojocampus.org/dijit/layout/BorderContainer"&gt;BorderContainer&lt;/a&gt; and other elements in the Dojo layout libraries can help you organize information in sidebars, footers, and &lt;a href="http://docs.dojocampus.org/dijit/layout/AccordionContainer"&gt;accordion containers&lt;/a&gt; on your page. (See &lt;a href="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/01/21/Using-the-Dojo-BorderContainer-to-design-application-layouts.aspx"&gt;this post&lt;/a&gt; for an introduction to Dojo layouts.) In some scenarios these might be more efficient than an info window. &lt;/p&gt;&lt;p&gt;The application pictured below avoids info windows in favor of a right-hand content pane containing charts and other information. Click the image if you're interested in downloading the code.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://resources.esri.com/arcgisserver/apis/javascript/arcgis/index.cfm?fa=codeGalleryDetails&amp;amp;scriptID=16445" title="Click to download the code for this example"&gt;&lt;img src="http://blogs.esri.com/Dev/photos/2008_server/images/9612/original.aspx" title="Information in an accordion container" alt="Information in an accordion container" width="313" height="224"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Designing a good info window&lt;/h3&gt;

&lt;p&gt;Although info windows can display all kinds of content, you should not use info windows as a "dumping ground" for information. A well-designed info window has:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;b&gt;A descriptive title&lt;/b&gt; – Keep the title short and clear&lt;/li&gt;

&lt;li&gt;&lt;b&gt;Formatting that is easy on the eyes&lt;/b&gt; - A few well-placed spaces, tabs, or line breaks can go a long way toward making the content easy to read.
&lt;/li&gt;

&lt;li&gt;&lt;b&gt;Clear labels for attributes&lt;/b&gt; - A non-GIS user looking at your application may not understand raw field names such as "PARCEL_NO". Instead, use clear descriptions or field aliases, such as "Parcel number". Avoid the ${*} shortcut that lists all field/value pairs.
&lt;/li&gt;

&lt;li&gt;&lt;b&gt;Attributes that are important to the end user&lt;/b&gt; – Many GIS datasets contain fields that are only of interest to a GIS analyst, not end users. "OBJECTID" is one example of a field that should probably never appear in a public-facing application.
&lt;/li&gt;

&lt;li&gt;&lt;b&gt;A manageable amount of information&lt;/b&gt; - Use tabs, sidebars, data grids, or links to other HTML pages if your info windows are getting too crowded and require the user to scroll.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;i&gt;Contributed by Sterling Quinn of the ArcGIS Server development team&lt;/i&gt;&lt;/p&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=9607" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Map+Tips/default.aspx">Map Tips</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Dojo/default.aspx">Dojo</category></item><item><title>Working with TextSymbol in the ArcGIS JavaScript API</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/10/26/Working-with-TextSymbol-in-the-ArcGIS-JavaScript-API.aspx</link><pubDate>Mon, 26 Oct 2009 20:50:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:9372</guid><dc:creator>sterlingdq</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/9372.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=9372</wfw:commentRss><description>&lt;P&gt;This post discusses how you can add text to your map using the ArcGIS JavaScript API. Your map service probably already has some labeling in it, but you may want to add descriptive information about graphics that you add on top of your map through tasks or queries. The ArcGIS JavaScript API does not have a built-in labeling engine with conflict detection and label placement algorithims, but you can use the &lt;A href="http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jsapi_start.htm#jsapi/textsymbol.htm"&gt;TextSymbol&lt;/A&gt; class to add text at a specific point location on the map.&lt;/P&gt;
&lt;P&gt;The &lt;A href="http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jsapi_start.htm#jsapi/textsymbol.htm"&gt;TextSymbol&lt;/A&gt; class has several properties that you can use to fine-tune the position and content of the text element such as angle, offset, font, and kerning (spacing between the letters). &lt;/P&gt;
&lt;P&gt;Use the TextSymbol.setFont() method to specify a font for the text. You can use the &lt;A href="http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jsapi_start.htm#jsapi/font.htm"&gt;Font&lt;/A&gt; class to set properties like text size, style and weight.&lt;/P&gt;
&lt;H3&gt;Creating a text graphic&lt;/H3&gt;
&lt;P&gt;Let's look at a code snippet that uses several of the Font and TextSymbol properties to create a new TextSymbol and add it to our map as a text graphic. This graphic will denote an unexplored area on our map using an old cartographic phrase "Here be dragons". First, we'll create the Font object and specify the font weight and size.&lt;/P&gt;&lt;PRE&gt;    
         var font  = new esri.symbol.Font();
         font.setSize("12pt");
         font.setWeight(esri.symbol.Font.WEIGHT_BOLD);       
&lt;/PRE&gt;
&lt;P&gt;Now we need to create a new TextSymbol and specify that it should be maroon, set at a 15-degree angle and be aligned to the start of our input point.Next, we use the setFont() method to assign the font we just created to the TextSymbol. Finally, we create a new graphic, assign it the newly created TextSymbol, then add the graphic to the map.&lt;/P&gt;&lt;PRE&gt;         var textSymbol = new esri.symbol.TextSymbol("Here be dragons");
         textSymbol.setColor( new dojo.Color([128, 0, 0]));
         textSymbol.setAlign(esri.symbol.Font.ALIGN_START);
         textSymbol.setAngle(15);
         
         textSymbol.setFont(font);      
        
         var pt=  new esri.geometry.Point(x,y,map.spatialReference)
         var gra = new esri.Graphic(pt,textSymbol);      
         map.graphics.add(gra);
&lt;/PRE&gt;
&lt;H3&gt;Simplifying the code&lt;/H3&gt;
&lt;P&gt;The code above is written in a verbose style to make it easier to examine the values we set for the TextSymbol and Font properties. We can reduce the length of the code snippet by using object constructors and chaining method calls. Let's explore this approach a bit: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;First, use map.graphics to get access to the map's default graphics layer. &lt;/LI&gt;
&lt;LI&gt;The GraphicsLayer has an add method that takes a Graphic object as a parameter, we'll create a new graphic within the method call using the Graphic constructor.&lt;/LI&gt;
&lt;LI&gt;Graphics consist of geometry, symbol, attributes and an infoTemplate. In our example, we don't need attributes or an infoTemplate so we'll use the Graphic constructor and provide only a geometry (Point) and symbol (TextSymbol)&lt;/LI&gt;
&lt;LI&gt;Let's examine the TextSymbol section a bit more closely. Many of the JavaScript objects, like Graphic and TextSymbol, have setter methods that return the object. Because of this we can chain method calls. In the snippet below, we create a new TextSymbol, define the text in the constructor, then chain setColor, setAlign, setAngle and setFont to reduce the amount of code we have to write. &lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;     map.graphics.add(
            new esri.Graphic(
            new esri.geometry.Point(x,y, map.spatialReference),
            new esri.symbol.TextSymbol("Here be dragons").setColor(
                    new dojo.Color([128,0,0])).setAlign(esri.symbol.Font.ALIGN_START).setAngle(45).setFont(
                    new esri.symbol.Font("12pt").setWeight(esri.symbol.Font.WEIGHT_BOLD))          
            )
        )
&lt;/PRE&gt;
&lt;P&gt;One caveat to this approach is that it can make the code more difficult to read; however, with a bit of practice it becomes second nature. &lt;/P&gt;
&lt;H3&gt;Samples&lt;/H3&gt;
&lt;UL&gt;
&lt;LI&gt;Click &lt;A href="http://serverapps.esri.com/javascript_examples/text_symbol_demo/text_symbol_demo.html"&gt;here&lt;/A&gt; to see a live sample that generates text graphics&lt;/LI&gt;
&lt;LI&gt;The &lt;A href="http://resources.esri.com/arcgisserver/apis/javascript/arcgis/index.cfm?fa=codeGalleryDetails&amp;amp;scriptID=15706"&gt;Graphic Symbology Code Generator&lt;/A&gt; on the Code Gallery generates JavaScript code for symbols and is a great tool to explore various symbol properties.&lt;/LI&gt;
&lt;LI&gt;To label polygon graphics, use the GeometryService.labelPoints() method to generate a point inside the polygon. You can then designamte this point as the label position. View the &lt;A href="http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/demos/utilities/util_label_point.html"&gt;Create points for labeling&lt;/A&gt; sample for details on how to use this method.&lt;/LI&gt;
&lt;LI&gt;Some text information may be better suited to display in an info window. The &lt;A href="http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/demos/map/map_infowindow.html"&gt;Show an info window&lt;/A&gt; sample shows how to display text in an info window at a specific location&lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Notes&lt;/H3&gt;
&lt;P&gt;There are several browser-specific issues to be aware of when working with fonts and text symbols. These issues are well documented in the &lt;A href="http://docs.dojocampus.org/dojox/gfx"&gt;dojox.gfx documentation.&lt;/A&gt; Some of the more common issues are:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The font family property does not work in Internet Explorer 7; Arial is always used.&lt;/LI&gt;
&lt;LI&gt;Several browsers including Internet Explorer 7, Firefox and Opera 9 do not support the rotated and decoration properties for text symbols.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;I&gt;Contributed by Kelly Hutchins of the ArcGIS JavaScript API development team.&lt;/I&gt;&lt;/P&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=9372" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Code+Snippet/default.aspx">Code Snippet</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/JavaScript/default.aspx">JavaScript</category></item><item><title>Which ESRI Web mapping API should I choose?</title><link>http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/10/19/Which-ESRI-Web-mapping-API-should-I-choose_3F00_.aspx</link><pubDate>Mon, 19 Oct 2009 18:14:00 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:9175</guid><dc:creator>sterlingdq</dc:creator><slash:comments>14</slash:comments><comments>http://blogs.esri.com/Dev/blogs/arcgisserver/comments/9175.aspx</comments><wfw:commentRss>http://blogs.esri.com/Dev/blogs/arcgisserver/commentrss.aspx?PostID=9175</wfw:commentRss><description>&lt;P&gt;Since the release of ArcGIS Server, ESRI has offered Web application developer frameworks (ADFs) for .Net, and Java. Last year, ESRI also released Web mapping APIs for JavaScript, Flex, and Silverlight, further expanding the choices for developers.&lt;/P&gt;
&lt;P&gt;One of the most common questions we’ve received at the ESRI User Conference and other recent seminars is: “Which API should I use?” When presented with this question, I like to respond with some questions of my own.&lt;/P&gt;
&lt;H3&gt;Which platform are your developers most comfortable with?&lt;/H3&gt;
&lt;P&gt;The APIs are functionally very similar, and often the most important question is not “What do you want to do?” but rather “Which platform are your developers most comfortable with?” If you’ve been working with the Microsoft stack and your developers are inclined in that direction, .Net and Silverlight look like good choices for you. Using similar logic, if your developers have spent the past 10 years adding custom scripts to your ArcIMS applications, they’ll probably find the JavaScript API to be a nice fit.&lt;/P&gt;
&lt;P&gt;Choosing a platform that your developers already know and enjoy can save you ramp-up costs and keep morale high. This is where the variety of APIs offered becomes a benefit instead of a burden.&lt;/P&gt;
&lt;H3&gt;What’s the experience level of your developers?&lt;/H3&gt;
&lt;P&gt;Many beginning developers find the JavaScript, Flex, and Silverlight APIs to be easier to learn than the Web ADFs because they have a more basic architecture. These APIs also have online Resource Centers, where you can watch videos, read tutorials, and examine working samples that are designed for beginners. ESRI has made sample ArcGIS Server deployments available so that you can practice with the APIs. In fact, you can get a JavaScript mapping application running on your machine with just Notepad and an Internet connection.&lt;/P&gt;
&lt;P&gt;In contrast, some developers like the deep functionality and familiar coding patterns of the .Net and Java ADFs; especially developers who have already worked with a lot of .Net, Java, or ArcObjects in the past.&lt;/P&gt;
&lt;H3&gt;Are browser plug-ins an option?&lt;/H3&gt;
&lt;P&gt;The ArcGIS APIs for Flex and Silverlight require browser plug-ins. If your application absolutely cannot require a plug-in, the JavaScript API or one of the ADFs will need to be your choice.&lt;/P&gt;
&lt;P&gt;The ArcGIS API for Flex requires the Flash plug-in, which &lt;A class="" href="http://www.adobe.com/products/player_census/flashplayer/"&gt;Adobe asserts&lt;/A&gt; is present in “99% of Internet-enabled desktops in mature markets”. The Silverlight plug-in has not yet reached the same level of ubiquity, but can be expected to gain ground.&lt;/P&gt;
&lt;P&gt;Plug-ins come in different versions, which may also present a hurdle in getting end users to experience your Web site in the way you expect. If you choose to use Flex or Silverlight, it’s wise to consider how flexible your clients are in their ability to upgrade plug-in versions. The ArcGIS API for Flex requires Flash Player 9 or above, or Adobe AIR. The 1.0 release of the ArcGIS API for Silverlight requires Silverlight 2 or above. &lt;/P&gt;
&lt;P&gt;Future editions of these APIs may require higher versions of the plug-ins. Also, any functionality that you add that is not native to the ESRI APIs may require higher versions.&lt;/P&gt;
&lt;H3&gt;Do you want to use an IDE? If so, which one?&lt;/H3&gt;
&lt;P&gt;When you choose an API, you are also making choices about the environment where you’ll spend your time coding. Flex users are probably going to need Flex Builder. .Net and Silverlight users will be doing work in Visual Studio or Visual Web Developer Express. Expression Blend is another option for Silverlight developers. Java developers can use Eclipse or NetBeans. JavaScript programmers probably have the most choices, including the option to just write code in a text editor.&lt;/P&gt;
&lt;P&gt;The pros and cons of these IDEs are beyond the scope of this post. Some IDEs cost money, but the time they save you in designing and debugging applications may help you recuperate the cost. If funds are tight, you may be able to get by without an IDE, especially if you are using JavaScript. Many commercial IDEs offer trial versions or free development versions that can help you decide if you want to make the purchase.&lt;/P&gt;
&lt;H3&gt;Do you need to edit features over the Web?&lt;/H3&gt;
&lt;P&gt;The .Net and Java ADFs offer access to fine-grained ArcObjects, which can be used to edit feature geometries. The ADFs contain out-of-the-box tasks (widgets) for basic Web editing operations. If you need to build an application with Web editing right now, one of the ADFs is your most likely option.&lt;/P&gt;
&lt;P&gt;Web editing is planned for the JavaScript, Flex, and Silverlight APIs at the release of ArcGIS Server 9.4 in 2010.&lt;/P&gt;
&lt;H3&gt;Do you need to overlay basemaps from Microsoft or Google?&lt;/H3&gt;
&lt;P&gt;Your organization may require you to use base data from Microsoft’s Bing Maps (formerly Virtual Earth), or Google Maps in your application. This can affect your decision of API.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Bing Maps is supported as a layer in the ArcGIS APIs for JavaScript, Flex, and Silverlight, as well as the .Net ADF. There is also an ArcGIS JavaScript Extension for the Virtual Earth API.&lt;/LI&gt;
&lt;LI&gt;Google Maps is available in the ArcGIS JavaScript Extension for the Google Maps API.&lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Are you more comfortable with established technologies or emerging technologies?&lt;/H3&gt;
&lt;P&gt;Some organizations approach new technologies with caution, whereas others jump at the chance to develop with the newest thing. Your organization’s attitude toward emerging technologies is important to consider, especially if you’re choosing between something like JavaScript, which has been around “forever”, and Silverlight, which just came on the scene in late 2007. This question is largely a matter of opinion, but can tip the balance in organizations where opinions run strong.&lt;/P&gt;
&lt;H3&gt;Have you talked with others who have made this decision?&lt;/H3&gt;
&lt;P&gt;ESRI conferences, forums, user groups, and blogs are a good place to learn from people who may have gone through a similar decision process. In fact, many of you who are reading this post may have additional advice, insight, or opinions on this question to share with others who are making the decision. Have you gone through this process before? Did you make a good choice? Is there anything you would have done differently? Leave a comment here.&lt;/P&gt;
&lt;P&gt;&lt;I&gt;Contributed by Sterling Quinn of the ArcGIS Server software development team.&lt;/I&gt;&lt;/P&gt;&lt;img src="http://blogs.esri.com/Dev/aggbug.aspx?PostID=9175" width="1" height="1"&gt;</description><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Java/default.aspx">Java</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Flex/default.aspx">Flex</category><category domain="http://blogs.esri.com/Dev/blogs/arcgisserver/archive/tags/Silverlight/default.aspx">Silverlight</category></item></channel></rss>