O V E R V I E W

Map Services

 

Map services offer access to map and attribute content. Map services can either be cached or dynamic. A map service that fulfills requests with pre-created tiles from a cache instead of dynamically rendering part of the map is called a cached map service. A dynamic map service requires the server to render the map each time a request comes in. Map services using a tile cache can significantly improve performance while delivering maps, while dynamic map services offer more flexibility.

 

Map services offer the following capabilities:

 

WSDL syntax

 

http://<Web Server Hostname>/<ArcGIS Instance>/services/<ServiceName>/MapServer?wsdl
 

Working with map services
 

Get information about the map and its layers
 

To access information about a map and its layers use GetServerInfo. GetServerInfo returns MapServerInfo and MapLayerInfo. MapServerInfo contains read-only information describing the default state of a map service, such as the name of the map, the background color or the spatial extent of the map. Read-only layer properties, such as the layer’s name, the layer’s attributes and whether or not the layer has labels associated with it, can be retrieved from MapLayerInfo.
 

If you wish to make changes to the map or to map layers you will need to use MapDescription or LayerDescription. Use MapDescription to access map settings that can be changed such as geographic extent and spatial reference. MapDescription provides access to information on individual layers within the map. LayerDescription provides the ability to change the visibility of a layer, to toggle the visibility of existing labels belonging to the layer and to assign a expression in order to display a specified subset of features.

 

Exporting a map image
 

To export a map image from a dynamic map service use ExportMapImage. An ImageDescription contains an ImageType and an ImageDisplay. Specifying the image format, such as JPG or PNG, is done using ImageType. Use ImageDisplay to  specify the height and width of the image. You can also specify a transparent color using ImageDisplay. The server will restrict the maximum size an image can be. Use GetServiceConfigurationInfo to view the maximum height and width. GetServiceConfigurationInfo contains a set of name-value pairs for properties set for the MapServer Service Configuration Restrictions.
 

Information about legend elements
 

You can retrieve legend elements including the symbol image, labels, descriptions and headings. A common use would be to populate a table of contents. To retrieve legend information, use GetLegendInfo and MapServerLegendInfo to retrieve specific information for a particular layer.

 

Querying the map

 

Map services offer a number of methods to perform query operations on the map. These include: Find, Identify, QueryHyperlinks, QueryFeatureCount, QueryFeatureData, QueryFeatureIDs, QueryFeatureCount2, QueryFeatureData2, and QueryFeatureIDs2.

Find returns an array of MapServerFindResults based on a search string. Use MapServerFindResult to access properties of found features, such as the found value, the layer ID, the field name, the geometry of the found feature and a set of name-value pairs for the found features's field names and values.
 

Identify returns an array of MapServerIdentifyResults based on search shape. Use MapServerIdentifyResult to access properties of identified features. These include: layer ID, name, a set of name-value pairs for the field names and values of the identified object, and the geometry of the identified.

 

QueryFeatureCount and QueryFeatureCount2 both return the number of features that match a query. The difference between the two operations is QueryFeatureCount requires a LayerID as one of the parameters, while QueryFeatureCount2 requires a LayerDescription instead. By passing in a LayerDescription you can query against a specific sub set of the layer by apply a definition expression.

 

QueryFeatureID and QueryFeatureID2 both return an FIDSet. This is the set of feature IDs that match the query criteria. The difference between the two operations is QueryFeatureCount requires a LayerID as one of the parameters, while QueryFeatureCount2 requires a LayerDescription instead. By passing in a LayerDescription you can query against a specific sub set of the layer by apply a definition expression.

 

QueryFeatureData and QueryFeatureData2 differ not only in the required parameters, but also in  what is returned. QueryFeatureData returns a RecordSet base on a specific query and includes a LayerID in the method parameters. QueryFeatureData2 returns a QueryResult. A QueryResult includes the URL of the generated query result in the requested format. The result format can be specified by using QueryResultOptions.  The query result can be formatted into a RecordSet or KMZ format (either as a URL to the kmz file or a Mime object). Another property includes GeoTransformation. This is used to specify any needed geographic transformation on the results.

 

The server will restrict the maximum number of records that can be sent. Use GetServiceConfigurationInfo the maximum records that can be returned in a query for this particular map service. GetServiceConfigurationInfo contains a set of name-value pairs for properties set for the MapServer Service Configuration Restrictions. This restriction does not affect QueryFeatureCount, QueryFeatureIds, QueryFeatureCount2 or QueryFeatureIds2.

 

Working with cached vs. dynamic map services
 

ArcGIS Server map services provide access to two types of visible map content: dynamic and cached.  Dynamic maps are generated on-the-fly per a user request.  Layer visibility, graphics, and other variables can be modified before the dynamic map is generated.  Unfortunately, as the amount of content and complexity in the map increases, so does the amount of time it takes to generate the map.  Alternatively, cached maps consist of pre-generated map tiles available for immediate access.  Since the cost of generating the maps has already been paid, the performance penalty associated with map generation is not a factor.   Working with a map cache requires knowledge of cache properties, such a location and structure, so that you are able to retrieve the appropriate cached image.   In general, a map cache is stored in a nested set of directories which contain image tiles for map extents at specific scale levels, or levels of detail.   The author of the map service determines these levels.  The cached tiles are usually accessible via a public virtual directory or an ArcGIS Server map service tile handler.  

 

Information about a map cache
 

Use IsFixedScaleMap to determine if a map service is cached. The term fixed scale map service and cached map service are used synonymously.  GetCacheDescriptionInfo returns information on a cached map service in one call including its cache type, its tiling scheme (TileCacheInfo), image information (TileImageInfo) and control information (TileControlInfo).

 

TileCacheInfo contains information on the tiling scheme for the cache. The tiling scheme includes the tiling origin, spatial reference, tile size in pixels and information on the Levels of Detail (LOD) at which the service is cached.  LODInfos enumerate a LODInfo object which describes a scale and resolution. Using the tiling scheme information in TileCacheInfo the client can calculate the tiles that cover any rectangular extent in map space and then retrieve tiles either directly from  the virtual directory, or from the tile handler or by making GetMapTile or GetLayerTile requests against the map service.

 

GetMapTile gets the specified tile from a map service that has a single fused cache. GetLayerTile gets the specified tile for a defined layer from a map service that has a multi-layer cache.

 

GetTileImageInfo returns information describing the image format for the cached tiles. TileImageInfo has two main properties Format and Compression quality. Format can have values (PNG8, PNG24, PNG32 and JPEG). If the selected format is JPEG, then the compression quality can have a value from 0 to 100. The value of format must be used in constructing the URL to the tile.

 

GetCacheControlInfo returns cache control information that allows clients to discover information such as if client caching is allowed.

 

Limitations

When generating a map image, map services are not able to perform the following tasks: 

 

Map services do not expose editing capabilities.  They merely provide read-only access to feature and attribute content.
 

Methods
 

Proxy method

Description

ComputeDistance

Calculate the distance between two points in a map (data frame).

 

ComputeScale

Calculates the scale of the specified map (data frame) at the given map extent for an image with the given size.

 

ExportMapImage

Generates a dynamic map image from a data frame (map) in an ArcGIS Server map service.  

 

ExportScaleBar

Generates a scale bar image for a data frame (map) in an ArcGIS Server map service.

 

Find

Searches the attributes of one or more layers in a data frame, in a map service for a given search string.

 

FromMapPoints

Converts map coordinates to screen coordinates.
 

GetCacheControlInfo

Gets the cache control information for a given map.  Primarily used to determine if client caching is allowed.
 

GetCacheDescriptionInfo

Gets the cache description information for a given map.  Includes cache control info, tile cache info, tile image info, and cache type info.

 

GetCacheName

Gets the cache name for a given layer within a map (data frame).

 

GetDefaultMapName

Name of the active map (data frame) in a map service.

 

GetDocumentInfo

A set of map service properties that can be used to describe the general content of the service.

 

GetLayerTile

Returns the image tile from a layer cache for a specific location.

 

GetLegendInfo

Returns legend information, such as layer name, group heading, classification labels and symbol swatches, for layers in a map.

 

GetMapCount

Returns the number of maps (data frames) in a map service.
 

GetMapName

Name of the map (data frame) as indicated by the index value provided.

 

GetMapTile

Returns the image tile from a fused map cache for a specific location.

 

GetServerInfo

Returns information about the present state of a map (data frame).

 

GetServiceConfigurationInfo

Returns a set of name-value pairs that contain information on map service configuration restrictions.

 

GetSQLSyntaxInfo

Returns SQL syntax information for the specified layer.

 

GetSupportedImageReturnTypes

Returns the supported formats for retrieving images generated by a map service.

 

GetTileCacheInfo

Get cache configuration properties for a given map.
 

GetTileImageInfo

Get information about the image format of the cache tiles.

 

GetVirtualCacheDirectory

Gets the virtual directory containing the cache tiles for a given layer within a map (data frame).

 

HasLayerCache

Determines if a given layer in a map (data frame) has a layer cache.

 

HasSingleFusedCache

Determines if a map (data frame) has fused cache.  Each map in a map service can only have one fused cache.

 

Identify

Returns map features and their attribute values based on a spatial search.

 

IsFixedScaleMap

Determines if a map (data frame) has a cache.  The cache may be a single fused map or a layer cache.

 

QueryFeatureCount

Returns the number of the features that meet the query filter selection criteria for the specified layer id.
 

QueryFeatureCount2

Returns the count of the features that meet the query filter selection criteria for the specified layer description.

 

QueryFeatureData

Returns a record set of features (geometry and attributes) that meet the query filter selection criteria for the specified layer id.

 

QueryFeatureData2

Returns a record set of features that meet the query filter selection criteria for the specified layer description.

 

QueryFeatureIDs

Returns a set of feature ids that meet the query filter selection criteria for the specified layer id.

 

QueryFeatureIDs2

Returns a set of feature ids that meet the query filter selection criteria for the specified layer description.

QueryHyperlinks

Returns feature geometry and associated hyperlink url for visible layers within a defined map extent.
 

ToMapPoints

Converts points from screen coordinates to map coordinates.