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:
- &MINX, which defines the minimum longitude of the extent.
- &MINY, which defines the minimum latitude of the extent.
- &MAXX, which defines the maximum longitude of the extent.
- &MAXY, which defines the maximum latitude of the extent.
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.
- Create a domain named RetailExtent.
- Right-click the domain, point to New, and click Procedure.
- 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 ENDThis procedure uses WHERE selection tests to show the markers only for the extent that is displayed.
- Create a new HTML page and add a map object and a button, as shown in the following image.

- 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.
- Select the map and configure the Settings panel as shown in the following image.

- In the Requests & Data Sources panel, right-click the retail_map request
and select Create Controls for Parameters.
The New Parameters dialog box opens.
- 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.
- Click OK.
- 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.

- 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.