To make a map available on the web, you need to author a map in ArcMap, publish it to your ArcGIS Server site, and then use the resulting map service in a client application. Many of the things you can do with map services require some preparation in the initial authoring phase. This topic includes questions you can consider when making a map that you plan on publishing to your site.
General tips
The following tips are important for all map documents that will be published to your ArcGIS Server site:
Avoid using nonalphanumeric characters (other than spaces) in data frame or layer names. When you publish a service, your data frame and layer names are sometimes used in URLs, cache folder names, and web service request parameters. Nonalphanumeric characters may not be interpreted correctly in these situations. Be especially cautious when your service is exposed through OGC specifications. For example, see Available WMS service properties for a list of characters that should never be used with WMS services.
Remove sensitive information from the document properties. ArcGIS Server includes the Services Directory, which allows users to browse the contents of your server and obtain metadata about your services. Even if you plan on allowing your services to be publicly visible through the Services Directory (the default configuration), there still may be some sensitive information in your map document that you want to obscure. To see what information might be visible, open your map document in ArcMap and choose File > Map Document Properties from the main menu. When you publish your map, you'll get a chance to remove any author user names, comments, or other information that you do not want to be visible through the Service Editor. You should edit the information as necessary to reflect the purpose and intended audience of your map service.
Remove any map service layers from the map document. Publishing a map document with an embedded service layer is not permitted.
Explicitly set a data frame background color instead of leaving the default null background color. The map service treats the background color as transparent, so you should avoid choosing a color found elsewhere in your map. To avoid white areas of your map becoming transparent, you can set the background color to near-white (example: RGB 254, 255, 255).
You can set the background color on the Frame tab of the Data Frame Properties dialog box.
Set up the map document to preserve layer and table IDs
In earlier versions of ArcGIS Server, the layer and table IDs of a map and feature services were not preserved after altering the source map document. This required you to update any client applications consuming layers and tables to use the updated IDs. To avoid updating client applications, it is recommended that you configure the map document to preserve the layer and table IDs, as described below.
- Open the source map document (MXD) in ArcMap.
- Right-click the name of the desired data frame and select Properties.
- In the Data Frame Properties dialog box, click General and turn on the option to Allow assignment of unique numeric IDs for map service publishing.
- Click OK. ArcMap auto-assigns sequential IDs to each layer and table in the data frame.
- If desired, assign your own custom IDs to layers and tables:
- Right click the layer or table in which you want to assign a custom ID and select Properties.
- In the Layer Properties dialog box, click General and assign a desired integer in the Layer ID field.
- Click OK.
- Repeat the above substeps for each desired layer or table.
- Publish the map document or overwrite the existing service.
The layer IDs are now preserved after publishing. You'll no longer be required to alter client applications after altering the source map document.
Can you cache the map for performance?
If your map contains data that is unlikely to change, you should consider caching your map for performance. When you cache your map, you create a set of prerendered map images at certain scale levels. The actual caching happens after you've published your map as a service. However, if you know that you're going to cache the map, this influences the map authoring process. You want to author the map so that it looks good at all the scales you are going to cache. You can use any cartographic tools without an effect on performance, because the cached tiles are just pictures of the data; the actual rendering and labeling engines are not used after you create the cache.
If you cannot cache your map, the rendering and labeling engines affect the performance of the map service. For more information, see What is map caching?
Performance tips for uncached maps
You should create a map cache whenever it's appropriate. However, if you have large amounts of data that are frequently changing, it may not be feasible for you to create and maintain a map cache. If this is the case, you can use the tips below to improve the performance of your map. When you're in the process of publishing your map document, you'll get a chance to analyze your map with the Service Editor. This can help you quickly identify ways to improve the performance of your map document.
Set scale-dependent rendering for data layers—Use scale-dependent rendering to ensure that unneeded layers are not drawn when the map is zoomed out. Data-intensive or detailed layers may be more appropriate only when the map is zoomed in to a larger scale.
Remove unused layers and data frames—Check both the page layout and data views and ensure that your map document is clear of data frames and layers that are unrelated to the map's purpose. For example, if the page layout view contains data frames that will not be shown in any application that uses the service, remove the data frames.
Use definition queries appropriately—A definition query can act as a filter to limit the amount of data on the map, thereby causing it to be drawn faster. For example, if you are creating a map of a state and your feature class contains data for the entire country, you can use a definition query to display only those features that fall within the state boundaries. Beware that some complex queries may negatively affect performance.
Simplify layer symbology—Complex symbols can take much longer to draw than simple symbols. Use simple line and fill symbols where possible, avoiding symbology that contains multiple layers, complicated dash patterns, hash lines, or outlines. Highway shield symbols may also slow drawing performance.
When using a picture fill symbol, you can improve performance by using an EMF file instead of a BMP.
An easy way to simplify some of the symbology in your map is to use the ESRI_Optimized style. This style contains both line and fill symbols that are designed to perform better while still maintaining a visual appearance similar to their counterparts within the default Esri style. See Organizing style contents in the ArcGIS Help to learn how to work with this style.
If you are creating a cached map service, simplifying your map does not affect the speed of the finished map delivery; it only affects the speed of the cache creation. If your cache already takes a reasonable amount of time to build, you might not need to worry about symbol simplification.
Use annotation instead of labels—Since labels require the computer to make placement decisions, it's generally faster to use an annotation layer.
Simplify labels—If your map contains labels, use the label and feature conflict weights sparingly. Halos, offsets, and other label effects also slow down performance.
Set scale-dependent rendering for labels—When a map is zoomed out, more labels need to be drawn, which takes time. Examine your map document and determine whether some labels do not need to be shown at smaller scales.
Use the same coordinate system for your data and map—When your source data and your map document have differing coordinate systems, your data has to be projected on the fly, thereby slowing performance. For optimal performance, use the same coordinate system for both your data and your map document. If this is not possible, make sure appropriate geographic transformations are applied to the layers that need to be projected on the fly.
Adjust the length of time the browser will use a response in its cache—When your map is viewed in a web browser, the map image response from the server is cached by the browser and reused for a certain period of time. Depending on how your map service and its associated data are used in applications, you may consider adjusting the length of time the browser will use a response in its cache. For full details, see the Improving the display performance of map services section below.
Improving the display performance of map services
When clients send requests to ArcGIS Server to display a map service, the response from the server is typically cached by the browser and reused for a certain period of time. This behavior helps ArcGIS Server achieve the best possible display performance for your map service. However, depending on how your map service and its associated data are used in applications, you may consider adjusting the length of time the browser will use a response in its cache. This can be achieved by adding a property named cacheControlMaxAge to the JavaScript Object Notation (JSON) of the service.
How the cacheControlMaxAge property is used
ArcGIS Server map service responses include an entity tag (ETag) and Cache-Control header. The ETag header value is a unique identifier of the response. The Cache-Control header has a max-age value that provides information to the browser regarding the maximum time period for which it can reuse a response from the browser's cache. This value is controlled by the cacheControlMaxAge property.
When a request is repeated and the maximum age of the cache has not expired, the browser uses the cached response without sending the request to the server. If the maximum age has expired, the browser must send the request to the server and set an IF-NONE-MATCH header with an associated ETag value corresponding to the response in its cache. ArcGIS Server evaluates the request and uses the ETag value to determine if the response has changed. If the response from the server is different from the copy on the browser, the server sends a completely new response to the browser. If the response is identical to the copy on the browser, the server alerts the browser to continue to use the response in its cache.
Defining the value of the cacheControlMaxAge property
As an ArcGIS Server administrator, you can define the cacheControlMaxAge property to specify how long a browser is allowed to use a cached response. By mitigating the need for ArcGIS Server to send a full response, you allow your browser caches to be more efficient, help optimize your applications, and save network bandwidth.
The default value for map services is 0. This means the browser will always resend a request and ArcGIS Server will process the request and send a full response to the browser if the content has changed. This value works well for most applications.
For map services with frequently changing datasets or symbology, a value such as 5 minutes (300 seconds) is recommended. In applications with animations or time-aware data, you should consider increasing the value to give your application a smoother animation experience.
To add the cacheControlMaxAge property to your service and specify its default value, do the following:
- In a web browser, open the ArcGIS Server Administrator Directory and log in with a user that has administrator privileges. The URL is formatted http://gisserver.domain.com:6080/arcgis/admin.
- Click services and select the map service you want to modify from the Services list. If you don't see your service listed, it may be in a directory under the Root folder.
- On the Service - <service name> (<service type>) page, scroll to the bottom and click edit.
- In the Service Properties dialog box, locate the "properties" section of the service JSON.
- Add the cacheControlMaxAge property to the section and specify the value (in seconds) for the property, for example:
"properties": { "cacheControlMaxAge": "300",
- Click Save Edits.
- On the Service - <service name> (<service type>) page, verify that the cacheControlMaxAge property and the value you specified for it appear in the Properties section.
Are you going to be viewing this map on a mobile device?
The Mobile Data Access capability allows you to extract the contents of a map service for viewing on a Tablet PC or Windows Mobile device. If you know that your map will be viewed on a mobile device, make it simple. Consider data generalization, such as polygon smoothing and reduced raster resolution, for background or reference layers. This helps the map to be drawn faster.
Are you going to perform network analysis on the server with this map?
If you're going to use this map for network analysis on the server, you need to include a network analysis layer that references a network dataset. When you publish the map service, you'll then have the option to enable the Network Analysis capability. This creates a web service for executing network analysis tasks on your map.