Tag Archives: maxrecordcount

ArcGIS RIA Developers: QueryTask not returning all your features?

All web mapping developers eventually face the challenge of optimizing the number of features that are displayed at each zoom level. This is especially true when designing web mapping applications for the best possible end-user experience. In fact, one of the most common problems is when a QueryTask occasionally returns only a portion of the requested features. When this happens you’ll see a result similar to the one shown in the screenshot below where large areas of point data are missing.

Some Questions to Consider

The good news is there are solutions to this problem. What’s happening is that in ArcGIS Server 9.3 and 9.3.1 there is a default configuration file setting that limits the number of records that can be returned for query, find and identify operations on a map service. The default setting is 500 records. However, before making any changes we recommend that you first consider these questions and their impact on the end-user’s browing experience.

  • Work-Flows: Do your end users workflows really require viewing 500 features all at the same time?

Example: Re-examine how end-users use your app. Have them walk you through the steps they need to accomplish their daily tasks. Pay attention to the zoom-level they are using. Do they zoom out really far before using their query or visualization tools? Maybe a search tool, or bookmarking tool will help them better manage zooming in and out of common locations.

  • Server Performance: Have you considered how this will affect your server’s performance? Queries that return more features are also more CPU intensive. How heavily used is the server, for example are there many users accessing it at the same time?

Example: Watch the CPU usage (e.g. Windows Task Manager) on your server during the heaviest usage period of the day. 

  • Roundtrip Times: How long does it take for your end user to get a response back from the server? If the server is working harder to process a larger result set, then its response times will increase. And, larger result sets also mean more work for the client app before the data is displayed.

Example: Time how long it takes for the query to complete before and after you make any changes. If your current query response times are already fairly slow, then the performance is only going to get worse if the users can return more records. And, if your end-users are running queries over and over again, then any perceived delays will start to add up.

  • Browser Performance: Have you tested your app’s performance on both FireFox and Internet Explorer?

Example: Test out the end-user workflows with all the features loaded and then pan-and-zoom around, or switch between layers. If you are using Windows, turn on the Performance Monitor so you can look at client-side CPU usage. If the browser responds sluggishly with 500 or fewer features or points, and CPU usage spikes, then you should consider reducing the number of features the end-users can access at a time. 

One Solution via Client-side Code

One possible solution is to limit the zoom level at which certain features are display, and then only query for features that exist within the visible extent. This concept is described in more detail in the Design Patterns for Web Maps blog post by the ArcGIS Server team, under the section titled “Strategies for displaying operational layers.” Basically, this pattern provides you with a graceful mechanism for controlling the amount of area that can be queried at any one time. Here is a live code sample that demonstrates the concept. Note that this sample uses a helper library called jsUtilities.js that retrieves graphics from only the part of the extent that changed. And, here is a psuedo-code snippet showing how to implement the helper library:

          if (currentLevel >= 16) {
            var queryPolygon = extent.erase(previousExtent);
            updateOperationalLayer(…..);
          }
 

Changing the MaxRecordCount Setting 

If you’ve considered the items mentioned above and you still need to adjust the MaxRecordCount based on your requirements, then here are the steps to change ArcGIS Server’s default setting:

  1.  Go to your service configuration file directory, and locate the appropriate configuration file:
  2. <ArcGIS install location>Serverusercfg<configuration file name>.cfg

  3. Change the MaxRecordCount setting:
  4. <MaxRecordCount>500</MaxRecordCount>

  5. Restart ArcGIS Server services.
  6. Test the change. If you experience time-outs, or the client performs poorly with the larger data sets, try reducing the MaxRecordCount, restarting the services, and testing again.

Additional References:

Design Patterns for Web maps

Five Steps to Better Performance (13.5 MB)

Help Doc for Service Configuration Files

Posted in Developer | Tagged , , | Leave a comment