Retrieving the Esri Map Viewer Current Extent Coordinates as Variables

The current extent of an Esri map can be retrieved as map parameters and used for subsequent filtering of map layers and reports. The extent can be in any coordinate system and must be a simple polygon.

The names of the map extent variables are:

Example: Using the Current Extent Parameters in a Map

The following steps create a map with a procedure that shows the markers within the current extent when the map is refreshed.

  1. Create a domain named RetailExtent.
  2. Right-click the domain, point to New, and click Procedure.
  3. Copy the following procedure, paste it into the text editor, and save it as retail_map.fex.
    -DEFAULT &MINX=_FOC_NULL
    -DEFAULT &MAXX=_FOC_NULL
    -DEFAULT &MINY=_FOC_NULL
    -DEFAULT &MAXY=_FOC_NULL
    
    DEFINE FILE WF_RETAIL_LITE
    LATITUDE = STATE_PROV_CAPITAL_LATITUDE;
    LONGITUDE = STATE_PROV_CAPITAL_LONGITUDE;
    END
    TABLE FILE WF_RETAIL_LITE
    PRINT
         ID_CUSTOMER
         QUANTITY_SOLD
         MSRP_US
         FST.LATITUDE
         FST.LONGITUDE
    
    WHERE RECORDLIMIT EQ 250
    WHERE COUNTRY_NAME EQ 'United States'
    WHERE LATITUDE GE &MINY
    WHERE LATITUDE LE &MAXY
    WHERE LONGITUDE GE &MINX
    WHERE LONGITUDE LE &MAXX
    ON TABLE SET PAGE-NUM NOLEAD
    ON TABLE SET ASNAMES ON
    ON TABLE NOTOTAL
    ON TABLE PCHOLD FORMAT XML
    ON TABLE SET HTMLEMBEDIMG ON
    ON TABLE SET HTMLCSS ON
    
    END
    

    This procedure uses WHERE selection tests to show the markers only for the extent that is displayed.

  4. Create a new HTML page and add a map object and a button, as shown in the following image.
  5. In the Requests & Data Sources panel, open the drop-down menu next to the New icon, point to External Request, and click WebFOCUS Procedure. Select retail_map.fex.
  6. Select the map and configure the Settings panel as shown in the following image.
  7. In the Requests & Data Sources panel, right-click the retail_map request and select Create Controls for Parameters.

    The New Parameters dialog box opens.

  8. Right-click the value in the first row of the Control Type column, point to Existing Control, and click emfobject1, as shown in the following image.
  9. Click OK.
  10. Select the button and in the Tasks & Animations panel create a task that will refresh the map when the button is clicked, as shown in the following image.
  11. Save the HTML page.

When you run the page, all of the markers are displayed on the map, as shown in the following image.

Zoom in and click the button. The map will be refreshed and only markers for that extent are displayed, as shown in the following image.