Get a Swatch for a Layer

Description

Returns an individual swatch for a layer of a named map by creating the swatch URL that contains the named map, the legend (layer) and row index within the map, the swatch size, and mime type of the swatch. The swatch is returned as the actual inline image for the swatch on the server.

ACL Authorization Flow

To return an individual swatch for a layer of a named map, the user (or the role they belong to) needs EXECUTE permission on the Named table.

HTTP GET URL Format

The following format is used for HTTP GET requests:

HTTP GET /maps/map name/legends/legend index/rows/row index/swatch/widthxheight.image type;
[r=resolution]

Parameters

For information on the parameter types listed below, see Request URL Data Types.

Parameter Type Required Description
map name String yes The name of the map to return the swatch. The map is specified by a regex for the named map to render based on the location of the named map in the repository. The name of the named map is defined between the /maps portion of the URL and the /legends portion of the URL. For example, to render a named map located at /earth/Europe in the repository, the following URL would be used:
http://pbbi.com/rest/Spatial/MappingService/​maps/earth/Europe/legends/...
legend index Integer yes The legend to get the swatch from in the named map. Since most maps have multiple layers, you need to specify in which legend the swatch is located. The first legend entry would be legend index 0 (zero).
row index Integer yes The swatch location (row) within the legend. Since some layers have multiple swatches within a single legend, you need to specify the row for the specific swatch. The first swatch entry (row) in the legend will be 0 (zero).
width Integer yes Width of the individual legend swatch in pixels
height Integer yes Height of the individual legend swatch in pixels
image type String yes The type of image to return the swatch(e.g., gif, png, etc.)
r=resolution Integer no The DPI resolution of the swatch as an integer. DPI measures the resolution of images in dots per inch (the number of individual dots that can be placed within the span of one linear inch). If not specified then assumes server default.

Returns

Returns the specified swatch image.

Example

Return the swatch for the first legend and first row of the WorldMap named map, located in the /Samples/NamedMaps directory in the repository. The swatch will be 32 x 32 pixels, in PNG format, and a resolution of 96 DPI.

http://hostname:port/rest/Spatial/MappingService/maps/Samples/NamedMaps/WorldMap/legends/0/
rows/0/swatch/32x32.png;r=96