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:

http://www.example.com/flexviewer/index.html?config=myconfig.xml
http://www.example.com/flexviewer/index.html?config=apps/myconfig.xml
http://www.example.com/flexviewer/index.html?http://resources.arcgis.com/en/help/flex-viewer/live/config.xml
Be aware that a
NoteNote:

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:

http://www.example.com/flexviewer/index.html?itemid=XXX

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
http://www.example.com/flexviewer/index.html?center=11563270,144180
// center with scale
http://www.example.com/flexviewer/index.html?center=11563270,144180&scale=250000
// center with zoom level
http://www.example.com/flexviewer/index.html?center=11563270,144180&level=11
// center with WKID - coordinates specified are different than map, therefore 
//WKID is provided
http://www.example.com/flexviewer/index.html?center=103.87,1.31,4326&level=8

NoteNote:

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
http://www.example.com/flexviewer/index.html?extent=1220000,7364000,1632000,7632000
//Zoom to Greater Copenhagen area passing in WKID
http://www.example.com/flexviewer/index.html?extent=14.70,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
http://www.example.com/flexviewer/index.html?search=Redlands,California,United States

11/25/2014