How To: Implement the Extract Server for an ArcMap Image service


Currently, the Extract function is not available for ArcMap services served through ArcIMS, only regular Image services. The workaround to this issue is to create a separate Image service that references the same data displayed in the ArcMap service. By doing this, users will be able to extract data based on the extents of the ArcMap service displayed in the HTML viewer.

It is important to note that there are certain limitations of the Extract server:

  • Only shapefile and ArcSDE vector data can be extracted.
  • Raster data and acetate layers cannot be extracted.
A good description of the capabilities of the Extract Server is described in the 'Using GET_EXTRACT and EXTRACT' section of the ArcXML Programmer’s Reference Guide. See Related Information section below for a link to this guide.


This procedure employs the ArcMap Sample data that comes included with the ESRI Sample Data for ArcIMS. This is located in <drive>:\Program Files\ArcGIS\ArcIMS\Samples\ArcMapServer\Data\usa

This procedure also requires that the sendArcXML utility is installed on the ArcIMS host. See the Related Information Section below for a link to download this utility.

  1. Create an ArcMap document (called states.mxd) that references the 'Cities', 'Rivers' and 'States' shapefiles stored in the directory above.
  2. In Administrator, create an ArcMap Image service 'states' based on the mxd created in Step 1.
  3. Open the sendArcXML utility in a Web browser.
  4. Determine the id values for each layer in the ArcMap service by sending a GETSERVICEINFO request to the "states" map service.
    [O-image] sendArcXML screenshot
    In this particular case:
    • Cities has an id = 0
    • Rivers has an id = 1
    • States has an id = 2
  5. Open Author and add the same three shapefile layers as in Step 1. Save the project as 'states.axl. There is no need to render the layers.
  6. Open states.axl in a text editor like Notepad.
  7. Add the following bolded code to each layer that will be used by the Extract server:
    <LAYER type="featureclass" name="Cities" visible="true" id="0">
    	<DATASET name="Cities" type="point" workspace="shp_ws-0" />
    	  <SIMPLEMARKERSYMBOL color="127,227,127" width="6" />
    	<EXTENSION type="Extract" >
    	  <EXTRACTPARAMS clip="true" />
  8. Change the id values for each layer so that they correspond to the id’s set for the same layers in the ArcMap service. That is, set the States id='2, Rivers id='1', Cities id='0'. Save and close this file.
  9. In Administrator, create an Image service called 'states_extract' for this modified axl file.
  10. In Designer, create an HTML viewer called Extract_ArcMap based on the ArcMap service created in Step 2.
  11. Open the ArcIMSParam.js file for the website created in step 10 with a text editor.

    Locate the following line:
    var useExtract=false;
    Change it to:
    var useExtract=true;
  12. Open the aimsCustom.js file located in the javascript folder, for example, C:\ArcIMS\Website\Extract_ArcMap\javascript, in a text editor and create two new global variables at the top of the file.
    var extractXMLMode=1111;
    var imsExtractURL = 'http://<servername>/servlet/com.esri.esrimap.Esrimap?ServiceName=states_extract&CustomService=Extract';
    Ensure that the imsExtractURL uses the correct hostname of the IMS server
  13. In the same file, locate the following line:
    function useCustomFunction(theReply)
    Change the function to look like the code below:
    function useCustomFunction(theReply) {
    	if (XMLMode==1001) {
    		// Insert code here.
    	} else if (XMLMode==1111) {
    	} else {
    		alert(msgList[55] + XMLMode + msgList[56]);
  14. In the same file, locate the following line:
    function extractIt() {(theReply)
    Change the function to look like the code below:
    // Extract layers to download.
    function extractIt() {
    if (checkIfActiveLayerAvailable()) {
  15. Add the following lines of code to the end of the file:
    function sendExtractRequest(){
    var extractAXL="";
    //extractAXL += '<?xml version="1.0" encoding="UTF-8"?>\n';
    extractAXL += '<ARCXML version="1.1">\n';
    extractAXL += '<REQUEST>\n';
    extractAXL += ' <GET_EXTRACT>\n';
    extractAXL += ' <PROPERTIES>\n';
    extractAXL += ' <ENVELOPE minx="' + forceComma(eLeft) + '" miny="' + forceComma(eBottom) + '" maxx="' + forceComma(eRight) + '" maxy="' + forceComma(eTop) + '" />\n';
    extractAXL += ' <LAYERLIST>\n';
    extractAXL += ' <LAYERDEF id="' + ActiveLayer + '" visible="true" />\n';
    extractAXL += ' </LAYERLIST>\n';
    extractAXL += ' </PROPERTIES>\n';
    extractAXL += ' </GET_EXTRACT>\n';
    extractAXL += '</REQUEST>\n';
    extractAXL += '</ARCXML>\n';
    sendToServer(imsExtractURL, extractAXL ,extractXMLMode);
    function parseExtractResponse(theResponse){
    var extractURL = getURL(theResponse);
    if(extractURL!="") var Win1 = open(extractURL);
  16. Save and close the file.
  17. Load the HTML viewer created in Step 10 into a web browser. Zoom to the desired location and use the extract tool.

Related Information