Archive for September, 2010

Clustering with the ArcGIS Server JavaScript API

Posted on September 9, 2010. Filed under: ArcGIS Server, JavaScript |

In this post I will describe how you can use a third party clustering tool in your AGIS JavaScript API applications.  Clustering is an excellent technique for visualizing lots of point data.  We’ve all seen applications where there were so many points that they simply appear as one big blob.  Clustering takes the individual points and groups them into clusters and then renders the cluster as one graphic.

Those of you using either the AGIS API for Flex or Silverlight have easy access to clustering functionality built into the APIs.  However, this hasn’t yet been done for the JavaScript API.  Fortunately, globoserve was provided with the clustering algorithm from ESRI and created a sub-classed GraphicsLayer to provide a third party adding clustering to your applications.  You can get additional information, see a demonstration, and download the Javascript files here.

I downloaded the JavaScript files and incorporated them into a simple application that displays retail customer data as points on the map.  In the first figure I have displayed all the customer locations as points on a map.  This results in a somewhat cluttered display of markers.

Next I applied clustering to the customer points which resulted in a much more appealing display.

The clustering algorithm automatically creates the clusters and then re-creates the clusters as you zoom in.

Let’s spend a little time discussing how you can easily integrate clustering in your application.  Here are the basic steps.

The first thing you’ll want to do is download the JavaScript files that you’ll need.  You can get them here.  There are three files in the download.  The first, Ext.util.DelayedTask-nsRemoved.js is a copy of ExtJsDelayedTask class with its namespace removed.  There is not a whole lot to say about this file so I won’t.  Globoserve discusses this file in a bit more detail.  The second file, esri.ux.layers.ClusterLayer-debug.js does the work of creating the clusters.  In this file, the esri.layers.GraphicsLayer class is extended to create a new class called esri.ux.layers.ClusterLayer.  In your code you basically just create a new instance of ClusterLayer, pass in some parameters, and it does work of creating the clusters.  There is also a “-min” version of this file which cuts down the size of the file for performance reasons.

Now that you’ve downloaded the files you can code your application to take advantage of the clustering.  There are a couple requirements.  First, the clustering algorithm uses the basemap’s tiling scheme for  its “grid” which means you will need a tiled basemap.  The WKID of the features being clustered should also be one of the following:

  • Projected: 102100, 102113
  • Geographic: 4326, 4269, 4267
  • Or matching the WKID of the basemap

On to the code.  I’ve created a displayCustomers() function which executes when the user clicks the Display button.  Inside this function I first create a QueryTask object that points to my customer layer.  This is a tiled map service.  I also create a Query object and set several parameters.  This Query object acts as input to the QueryTask object.  Here we have defined parameters to return the geometry of the features, return all records (1=1) and specified that we’d like to return the Address and LastName fields.  This is highlighted in green in the figure below.

Once the QueryTask has finished executing a featureSet is returned to the callback function which creates a new ClusterLayer object.  Several parameters are supplied for the creation of this object.

  • map – refers to an esri.Map objects from the AGIS API
  • features – this is just a reference to the featureSet that was returned from the QueryTask execution
  • infoWindow – configuration options for the infoWindow that will appear when you hover over each individual graphic point.  You can see an example of this below.
  • flareLimit – the number of “flare graphics” that can appear around a cluster (default is 20)
  • flareDistanceFromCenter – the distance in pixels that the flare graphics appear from the center of their cluster.

From there we simply call Map.addLayer passing in our new instance of the ClusterLayer object.  That’s pretty much all there is to it.  I’ve included some screenshots below to show the flaring and infoWindows.  Once again, thanks to Adam at globoserve for creating this really useful functionality that many of you will no doubt use in your applications.

The next session of our Mastering the ArcGIS Server JavaScript API begins October 4th, 2010.  We still have seats available.

Read Full Post | Make a Comment ( None so far )

Help Wanted: ArcSDE

Posted on September 7, 2010. Filed under: Uncategorized |

I’m looking for someone to do a very short term contract ArcSDE job.  If you’re experienced with installing and configuring ArcSDE on MS SQL Server please contact me at: eric at

Read Full Post | Make a Comment ( None so far )

Introducing the ArcGIS Server Mastery Club

Posted on September 3, 2010. Filed under: AGIS Server API for Flex, ArcGIS Server, ArcGIS Server for Silverlight, ESRI, GeoSpatial Training Services, JavaScript |

GeoSpatial Training Services is excited to announce the immediate availability of the ArcGIS Server Mastery Club!

This is our most exciting product to date for anyone looking to develop custom ArcGIS Server applications with any or all of the ArcGIS Server REST APIs including Flex, JavaScript, and Silverlight.

In our new ArcGIS Server Mastery Club you have 24 x 7 access to all our ArcGIS Server course materials including Introduction to ArcGIS Server, Basic ArcGIS Server Concepts for Developers, Programming the ArcGIS Server API for Flex, Mastering the ArcGIS Server JavaScript API, and Programming ArcGIS Server with Silverlight.

We provide serveral pricing options:

  • Single User Monthly Subscription $59.00
  • Single User Annual Subscription $799.00
  • Unlimited Users Annual Subscription $2999
  • Academic Unlimited Users Annual Subscription $1999

In addition to all the great content that you can access today you will also have immediate access to all future courses that we develop for the ArcGIS Server platform.  In early 2011 we expect to release two new courses that will be part of the club: Integrating Social Media with ArcGIS Server Applications, and Developing GIS Applications for the iPhone and iPad.

What comes with the ArcGIS Server Mastery Club?

  • Complete access to all our ArcGIS Server course materials including
    • Introduction to ArcGIS Server
    • ArcGIS Server Concepts for Developers
    • Programming the ArcGIs Server API for Flex
    • Mastering the ArcGIS Server JavaScript API
    • Programming ArcGIS Server with Silverlight
  • Immediate access to new course materials as they come online
    • Integrating Social Media with ArcGIS Server Applications (coming in late 2010 or early 2011)
    • Developing GIS Applications for the iPhone and iPad (2011)
  • 24×7 access to all lectures, exercises, capstone projects, and more
  • Access to over 1,000 pre-recorded audio lecture slides
  • Access to 60 exercises covering all the REST development platforms (Flex, JavaScript, Silverlight)
  • New exercises added every month
  • Article digest containing articles of interest for ArcGIS Server developers
  • Guest interviews with subject matter experts
  • 24×7 discussion forums for communicating with other members and moderators
  • Integrated chat for communicating with members and moderators
  • Code examples
  • Work with others in the club to develop custom, live applications
  • Learn from the comfort of your home or office, at the time of your convenience
  • Group application development projects to refine skills
  • Application development contests
  • Job board
  • Recommended books and websites
  • Get education credits toward your GISP certification
Read Full Post | Make a Comment ( None so far )

Reading Materials for the Labor Day Weekend

Posted on September 3, 2010. Filed under: Uncategorized |

Just wanted to share a few interesting articles and blog posts that you might be interested in reading over the long weekend.

New ArcGIS Server Tips-n Tricks Videos

New MapQuest Directions API Built on Open Data

Location-Based Services Move into the Supermarket: Pancake Mix on Aisle 6

Where the Startups Are, by Zip Code

Google APIs: A to Z

Populate a ComboBox with Unique Values using a Query Layer

Enterprise-level IP Geolocation Made Available Via API

A Brief Look at Web GIS, Twitter and Authenticating with OAuth

Read Full Post | Make a Comment ( None so far )

Liked it here?
Why not try sites on the blogroll...