Map Sheet Production Utility


This utility implements an Extension to ArcMap to automate the production of map sheets, either creating plots on a plotter or map documents (MXD files) for later editing.

The utility has a tabbed dialog interface, with 3 tabs. The first allows the user to select the map sheet that will be produced by making graphical selections on an index map. The second allows the user to set the scale that the map will be produced at, and select the marginalia that will be included. The third tab is used to select the data to be used in the index map.

The configuration of the Index Map is persisted within the map document (mxd file).

The first and third tabbed pages can be used with little or no customization; however, it is assumed that the second page will be customized to support the marginalia requirements of individual users.

This document covers using the tool with no customizations with one of the sample datasets supplied with ArcInfo. The steps required to customize it are also described in detail to allow users to take this sample and extend it.

How to use:
  1. The DLL PlottingFromIndex.dll must be registered onto the system. The easiest way to perform this is to load the Visual Basic project PrintMapSheet.vbp and compile the project, this makes the DLL and registers it on the computer. Otherwise use the regsvr32.exe program supplied with the operating system.

  2. With the DLL registered it must be added to the correct component category in order for ArcMap to locate it. To perform this, start the Categories application (found in the Bin directory of ArcInfo) and Add the class clsExtension from the PlottingFromIndex.dll to the ESRI Mx Extensions category and the clsCommand to the ESRI Mx Commands category.

    With the DLL correctly registered onto the system, ArcMap will initialize the component correctly.

  3. Start ArcMap.

    - To create a new document using the tutorial data perform go to step 4.

    - To use a pre-saved map document go to step 7.

  4. The index map is configured by loading pre-saved layer files into the index map, and then ordering the resultant layers and specifying which layers are to act as indexes.

    The data for the index layer(s) should be loaded into ArcMap along with the topographic background data. The layer properties are set to values that display the index data correctly. Commonly this involves changing the symbology and the scale dependant drawing. (For this walk through it is assumed that the sample data included with this tool is used)

    A Feature Class used as an index must have polygon features that represent the sheet boundaries, and one string attribute called Name which contains a unique identifier. Each feature can have an optional attribute MapScale used to assign appropriate map scales on a sheet by sheet basis.

    Using this technique is is possible for one index map to work with many different scales. For example, as the user zooms in more detailed map sheets at larger scales appear, and less detailed sheets disappear.

    Suitable sheet index data can be found in the Personal GeoDatabase in the data directory of the developer samples (GreenValleyDBIndex.mdb). This index feature class can be combined with the street feature class included within the ArcTutor Green Valley database.

    When the layers are ready they are saved to layer files, and then they are removed from the map.

  5. The layer files created in step 4 must now be added to the index map.

    To bring up the Map Sheet Production Utility dialog click on the Map sheet icon.

    This has 3 tabs, the Map Sheet allows the user to display the index map, and label the index and the background topographic data. When a selection is made the user can select the Plot Settings tab in order to create the plot or map document. The Index Setup tab allows the user to configure the Index map. The Index Setup tab should be selected.

    The user should select all the layer files required in one operation using the Dialog displayed by pressing the Select Layers... button. The layers are loaded into the Index Layers list box. Using the buttons below the order of these layers can be changed. The user specifies a particular layer as an index layer, as opposed to a background layer, by checking the check box. This means that the features in this layer will be selectable.

    The user loads the map data into the index map by pressing the Load Data button. The user should now confirm that the layers have been loaded correctly by displaying the index map by clicking the Index Map Window button.

    To ensure that these settings are preserved in the map document the user should now save the current document. The layer files are no longer required and can be deleted if desired. All settings for the index map are stored within the map document.

  6. Now that the index data is all set, the map data used within the produced maps must be loaded into the map document. Load the appropriate data from the Green Valley Personal GeoDatabase included with ArcTutor. Set the representation to something appropriate and switch to Layout View.

    The page orientation should be set to Landscape, and the document saved.

    Go to step 9.

  7. Load the map document GreenValley.mxd. This document makes use of the Personal GeoDatabase (GreenValleyDBIndex.mdb) found in the map sheet utility source directory, this database holds one feature class that implements the sheet index. The other database used is the GreenValley.mdb Personal GeoDatabase found in the ArcTutor directory, which holds the map data. If the data is installed in a location other than the default the data sources will need to be repaired.

  8. To bring up the Map Sheet Production Utility dialog click on the Map sheet icon.

    This displays the tabbed dialog shown below.

    This has 3 tabs, the Map Sheet allows the user to display the index map, and label the index and the background topographic data. When a selection is made the user can select the Plot Settings tab in order to create the plot or map document. The Index Setup tab allows the user to configure the Index map.

  9. To Select a map sheet for processing the user must display the Index map window, by pressing Display Index Map button. This displays the form shown below. There are simple controls to allow the user to navigate around the index map, and to select the map sheet.

    When a map sheet is selected details of the map sheet are displayed in the bottom half of the expanded main form. If more than one index sheet is selected in the map display the user can refine the selection by selecting the sheet in the list. A context menu on this list helps to locate the appropriate sheets in the index map window.

  10. With the appropriate sheet selected the Plot Settings tab is selected.

    The user can select the items to be included with the plot. If there is an attribute on the index feature holding the scale the scale of the map is displayed, otherwise a default of 5000 is given.

    The check box Scale To Fit controls the map behavior if the paper size is not large enough to plot the map sheet at the desired scale. If the paper is not big enough for the requested scale all the marginalia is scaled to fit on the paper in order to maintain its position relative to the data frame. The scale of the map data within the data frame is dependant on the Scale To Fit check box. If this is toggled on, the scale of the map is changed to display the full extents of the data. If toggled off the scale is kept the same but the extent of the map data is changed.

    The user can choose either to plot the data out directly to the current printer, or create a map document. If Create Document... is selected the user is prompted for a filename.

  11. When the map sheet Oakwell is plotted out on paper of Letter size it looks like below.

					(199272 bytes) Click image to display full size.

  12. If a plot is produced it is a assumed that a postscript plotter is available.To View the Document created the user should open the document using ArcMap.

    NOTE: By default the creation of the map document or plot file is performed with no visual feed back to the user. If the Verbose check box on the Index Setup page is toggled on the layout with all the marginalia is drawn for the user. In addition the user is given the option of producing a plot or document, and if the layout should be cleared on completion of the operation. This is a useful debugging feature while customizing the marginalia.

How to Customize:
  1. All the source code for the utility is provided, meaning that any it is wide open for customization, however, to simplify the process it is possible to restrict the customizations to one class ctlMarginalia. This class implements a User Control that consists of a User Interface with its associated code for supporting this, three properties: ScaleToFit and MapScale used by the utility when setting up the page layout and Enabled used to enable or disable the UI, and three methods; BuildMarginalia that generates all the marginalia on the page layout, ItemSelectedInList which is called anytime the highlighted item in the list is changed, and PageBorders which returns the page borders required for the marginalia placed on paper at the optimum page size for the requested map scale.

    The developer must ensure that these properties and method are implemented for the utility to function correctly.

  2. Below is a graphic of the user Interface for the class ctlMarginalia. The frame should enclose all the elements of the UI. If the frame is extended in size the UI will not fit the container form correctly.

    The developer can add or remove elements from this form to meet the needs of the users' marginalia. The example makes use of some common marginalia elements.

    Any changes to the UI must be accompanied with changes to the associated code. In particular the property Enabled must be changed to enable and disable all the UI components.

  3. The ScaleToFit property is used to signal what data scaling should take place if the paper size is not big enough for the scale of plot requested. In the example code the UI supports the user selecting this functionality but it can easily be hard wired to a preset value.
  4. Similarly the MapScale property gives the desired scale for the output map or document. If the Scale cannot be accommodated on the paper size this scale may be automatically changed by the utility to honor the ScaleToFit property.
  5. The PageBorders method returns the values required for the marginalia in metres. The utility then uses this information to place the data frame in an optimal position on the paper to ensure that the marginalia will be positioned correctly. If the paper is not big enough these borders are decreased proportionately, hence it is important to scale the marginalia using the scaling factor described in more detail below.
  6. The NewItemSelected method implemented to update the UI with data that is contained with the sheet features of the index dataset, this would normally be the sheet scale and name, but could be any relevant information.
  7. The BuildMarginalia method performs most work of the control. This method is responsible for creating the marginalia elements on the paper. This method takes various arguments that the developer will use when creating the sheet marginalia:

    sheetIDStringUnique name of the map sheet being produced
    pSheetPolygonIPolygonPolygon interface representing the map sheet boundary in Map Units
    pAdjacentSheetsCollectionCollection of features representing the map sheets that intersect with the map sheet being produced
    pMapIMapMap in the current data frame.
    pGraphicsContainerIGraphicsContainerThe graphics container holding the elements within the page layout
    pScreenDisplayIScreenDisplayThe screen display associated with the page layout
    pMapPlotBoundsIEnvelopeThe envelope in page layout units containing the map data frame.
    pPrintableBoundsIEnvelopeThe envelope in page layout units which is the maximum printable area of the paper.
    scalingDoubleThe scale factor that must be applied to the marginalia elements in order for them to fit on the paper.
    pPaperIPaperThe paper associated with the ArcMap application

    Examples of these arguments being used can be seen in the various Private functions within the ctlMarginalia class. For example, in the PlaceSheetTitle function many of these arguments can be seen in action. The map title is placed in the middle of the page 5 millimeters about the top of the map. Notice the use of the utility function ConvertToScaledPagedUnits, this function takes in meters and converts the distance to the appropriate page units, at the correct scaling. Also notice the use of the ConvertToScaledUnits function which is used to convert the text height in points to the scaled text height in points. Using these utility functions ensures that the marginalia will be scaled to fit the page size if required. Many of the common primitive element types have corresponding creation utility functions contained within the MarginaliaUtility module. These functions wrap up the work of creating elements, assigning the element a name, activating it and adding it to the graphics container. Notice the use of the c_ElementPrefix constant at the beginning of the element name. All elements automatically generated have this prefix in order that these elements can be found and deleted on completion of the map plot or document creation process.


Requires: ArcTutor, Green Valley Database

Difficulty: Advanced

Visual Basic
File Description
clsCommand.cls Class implements the ICommand interface. This class supports the ability for the tool to be placed on a toolbar within ArcMap. To successfully function the Extension class must be loaded.
clsExtension.cls Class implements the IExtension and IPersistVariant interfaces. The primary function of this class is to support document persistence. The class also hold a reference to the Map Sheet Production form, which is used by the Command.
ctlMarginalia.ctl User Control that has UI, properties and methods to create individual marginalia components in the layout. This is the code that must be customized to support user defined marginalia.
frmAbout.frm Implementation file for the About dialog.
frmMain.frm Implementation file for the Main tabbed dialog.
frmMapWindow.frm Implementation file for the map display window.
GreenValley.mxd ArcMap document, used by the example.
ArcMap document, used by the example. Personal GeoDatabase used holding the example Sheet Index feature class.
MarginaliaUtility.bas Basic module containing functions and sub routines useful when creating marginalia elements in a page layout.
PlottingFromIndex.dll Compiled Map Sheet Production Utility ArcMap extension.
PrintMapSheet.reg Registration file used to register the command and extension classes into the appropriate component categories.
PrintMapSheet.vbp Visual Basic project file.
Utility.bas Basic module containing software constants, and utility functions.
ErrorHandler.bas Basic module containing generic error handling routines.

Key Interfaces: ICommand, IExtension, IMap, IMapSurround, IPersistVariant