Strategies for using feature limits expand/collapse all
Related Topics

aimsamsrv.cfg reference for ArcMap Server

aimsfs.cfg reference for Feature Server

aimsqs.cfg reference for Query Server

SPATIALQUERY

GET_FEATURES

expand/collapse item About feature limits

ArcIMS services, by design, have no limits on the number of features that can be selected or queried. Users can inadvertently or maliciously request unlimited numbers of features. Feature queries do not have scale dependencies. This means that all features for a layer can be requested even if the layer is not displayed on the map for a given scale. Some common ways a user can request many or all records for a layer are:

Fortunately, ArcIMS has several built in ways to set limits to the number of requested feaures when making GET_FEATURES requests.

Setting a global feature limit

A global feature limit can be set in the Spatial Server configuration files limiting the number of requested features from all layers in all services. By default, the feature limit is 2000 for queries made to Image and ArcMap Image Services. No upper limit is set for Feature Services. For ArcMap Image Services, this is the only place on the server to limit the number of requested features. Higher values can lead to slower performance. More importantly, when many large queries are executed they may block and prevent shorter queries from executing until completion of the excessively long queries. In addition, large responses can hang a client viewer.

Setting feature limits in a map configuration file

If you do not wish to set a global limit on the number of features returned, or you want to refine the feature limit, it is possible to set limits on a layer by layer basis for Image and Feature Services. A feature limit cannot be set in the map document for ArcMap Image Services.

Setting a feature limit in a configuration file is implemented via the SPATIALQUERY element. Instructions for adding this element can be found in Adding SPATIALQUERY.

Requesting a specified number of features

The third way in which the number of features can be limited is to set a feature limit when requesting data from a client. In many cases, you may want to limit the number of returned features to something manageable. For example, you many want to return only 10 records at a time and allow users to page for the next or previous 10 records. Instructions for specifying the number of features in a request is covered in more details in the ArcIMS customizing guides.

Feature limit hierarchy

The hierarchy for all the feature limit settings are as follows:

  1. The feature limit in the Spatial Server configuration files is the maximum that can ever be returned in one request. If you have ever wondered why you never get more than 2000 records, it is because of this feature limit.
  2. SPATIALQUERY featurelimit in a map configuration file overrides the value in #1 if it is smaller.
  3. GET_FEATURES featurelimit overrides the values in #1 and #2 if it is smaller.
  4. In a GET_FEATURES request, SPATIALQUERY featurelimit overrides GET_FEATURES featurelimit. In both elements, the feature limit must be smaller than #1 or #2, or it is ignored.

HTML Viewer behavior with feature limits

The HTML Viewer has several safeguards in place to protect against bad queries or queries that return too many features. First, a layer must be turned on and must be visible for the given scale before any features can be queried. Second, although all features may be selected on a map, a request returns records for only 25 features at a time.

These constraints have been placed at the application level. Other applications or users who understand how to send requests to an ArcIMS Servlet Connector can bypass these HTML Viewer safeguards. Therefore, although you may not run into too many problems with requests from an HTML Viewer, you need to protect your site from these other users and applications.

ArcMap as a client

A good example of another client that uses the same Servlet Connector as the HTML Viewer is ArcMap. Unlike the HTML Viewer, ArcMap does not limit the number of returned features. In addition, the layer does not need to be visible or within scale range for features to be selected.

Relationship of displaying features on a map and displaying attribute data

The feature limits described so far limit the amount of attribute data. Depending on the client, when a user selects features on a map, some or all the selected features will display on the map. If you are using Image or ArcMap Image Services, all selected features in a map are highlighted even if the number of features is greater than the feature limit. If you are using Feature Services, the maximum number of features that will draw is limited to the feature limit value. The reason is that feature geometry used for displaying features on a map and feature attributes are bundled together in the same feature stream. Therefore, the feature limit is applied to both.

If you are viewing services using ArcMap as a client, the maximum number of features that will draw will not exceed the feature limit. The reason is that ArcMap makes a request for attribute data using a feature stream, regardless of the service type. This is the same behavior as with Feature Services.

Limiting the number of features drawn on a map for Image Services

You can limit the number of features drawn on a map when using an Image Service: This is done by setting a parameter in the Image Server configuration file. When you set this parameter, the value affects all layers in all Image Services. Therefore, the value should be larger than the maximum number of features you would expect to be drawn in your largest layer. In other words, if a layer draws 1,000 features, and this is appropriate, you would want to set the feature limit greater than 1,000.

Setting this parameter should only be necessary if for some reason you have many features in a layer and cannot set scale dependencies for some reason. Ideally, each layer in a map configuration file should be displayed only at the appropriate scale. However, to prevent users from requesting large amounts of data from dynamic layers, setting a limit may be appropriate depending on the size of your data sets.

How to select appropriate feature limits

Choosing the appropriate feature limit depends on the service type, performance considerations, and data sensitivity among other factors.

expand/collapse item How to implement feature limits in the Spatial Server configuration files

expand/collapse item Setting attribute feature limits for Image, ArcMap Image, and Feature Services

  1. In a text editor, search for the Spatial Server configuration file directory.

    Windows: <ArcGIS Installation Directory>\ ArcIMS\Server\etc
    UNIX and Linux: $AIMSHOME/etc

  2. Open the appropriate configuration file:
    • aimsqs.cfg for Image Services
    • aimsamsrv.cfg for ArcMap Image Services
    • aimsfs.cfg for Feature Services.
  3. Locate the featurelimit attribute in the PARAMETERS section.

  4. <PARAMETER name="featurelimit" value="2000" />
  5. Specify a numeric value for the maximum allowed features in a user's query. The higher the value you specify, the bigger the hit to performance and the greater the chances are that your site may shut down if too many large queries are made at the same time. The default value for Image Services and ArcMap Image Services is 2000. The default value for Feature Services is no limit, which is specified by -1.
  6. Repeat steps 1-4 as needed to make the same changes on each machine in your site configuration that has a Spatial Server installed.
  7. Restart ArcIMS Monitor and ArcIMS Application Server.

expand/collapse item Setting an image feature limit for Image Services

  1. In a text editor, open aimsms.cfg from the following location:

    Windows: <ArcGIS Installation Directory>\ArcIMS\Server\etc
    UNIX and Linux: $AIMSHOME/etc

  2. Locate the imagefeaturelimit attribute in the PARAMETERS section.

  3. < name="imagefeaturelimit" value="-1" />
  4. Specify a numeric value for the maximum allowed features in a map. The default value is no limit, which is specified by -1.
  5. Repeat steps 1-3 as needed to make the same changes on each machine in your site configuration that has a Spatial Server installed.
  6. Restart ArcIMS Monitor and ArcIMS Application Server.


Search code: @security_featurelimits