Viewer URL parameters

Version 3.7

Modifying the Viewer using URL parameters

In addition to configuring the ArcGIS Viewer for Flex ("the Viewer") using configuration files, you can also identify the web map to use and specify where the map should start. These are optional settings and are not required. The config parameter allows you to switch the main configuration file, while the other parameters discussed in this topic overwrite what is specified in the map section of the main configuration file.

Specify the configuration file

Set the config parameter to any config file. It can be in the same directory, a different directory, or on a different machine. See the following code sample:
Be aware that a

Any folder references within the configuration file will be relative to the index.html (or technically the index.swf) and not from the configuration file itself.

Specify a web map

Set the itemid parameter to an ArcGIS web map item ID that is publicly available. See the following code sample:

Center on specified coordinates

You can specify the center point with a map scale or specific zoom level.

If you specify a center point, you can also specify a map scale or a zoom level. If the center point's coordinates are not in the same spatial reference as the map, you should also provide the WKID as an additional parameter [added at 3.3] in addition to a level parameter. See the following code sample:

//Center on Singapore - assumes coordinates are same as map,144180
// center with scale,144180&scale=250000
// center with zoom level,144180&level=11
// center with WKID - coordinates specified are different than map, therefore 
//WKID is provided,1.31,4326&level=8


You should pass in the level parameter if level is not indicated in the parameters, the Viewer uses the default extent width and height.

Specify an initial extent with coordinates

The extent parameter accepts a comma-separated string of xmin,ymin,xmax,ymax , similar to the space separated string used for initial and full extent properties in the <map> tag in the main configuration file. The extent should be specified in the same spatial reference as your map. If the spatial reference is different than the extent, you will also need to pass in the WKID as an additional parameter in addition to the level (see note above).

// Zoom to Greater Copenhagen area,7364000,1632000,7632000
//Zoom to Greater Copenhagen area passing in WKID,51.76,12.66,59.37,4326&level=8

Specify initial extent using a search

You can also pass in search criteria to zoom to. This is similar to using the search functionality in the Header Control.

//Zoom to Redlands, CA,California,United States