Instructions on how to customize the DS Map Book ArcMap add-on to show only the current mapbook index polygon

www.DavidKimball.com

This is most useful when the polygons you are using are not rectangular tiles but normal polygon features, and you want to call attention to the current feature without showing all the others (you can show the others with a different symbology if you like). However it can be used with rectangular tiles as well.

To do this you need to edit the DSMapBook code using VB6. You must have VB6 software to do this.

This modification requires that you have a layer named "Special Mapbook Layer" in the TOC (this is typically the index layer or a copy thereof, but can be any layer that has a "title" field that contains appropriate values), and the title field in this layer (the field that holds the mapbook page title values) is named "title".

You can change these names in the code if you want. Obviously, "Special Mapbook Layer" will look pretty silly in your legend, so you'll have to either make a dummy layer with no features but the correct name and symbology, or give the layer's symbol a Label (text to the right of the symbol in the TOC) so the legend will show that instead of the layer name for that layer. If you don't have a layer named "Special Mapbook Layer" in your map, the custom code will exit gracefully (e.g. nothing will happen) and DSMapBook will work as usual.

Before attempting to modify DSMapBook, make sure you make a backup copy of the entire C:\Program Files\ArcGIS\DeveloperKit\samples\Cartography\Map_Production\DSMapBook folder in case you make a mistake.

Double-click the file C:\Program Files\ArcGIS\DeveloperKit\samples\Cartography\Map_Production\DSMapBook\Visual_Basic\DSMapBookPrj.vbp - it will open in VB6 (which you must have installed to do this).

In the Project window, double-click DSMapPage (under Class Modules).

In the IDSMapPage_DrawPage subroutine, at the end of the subroutine just before the Exit Sub statement (the one before the ErrHand: statement), place the following line:



SelectCR pmap, m_sPageName

This will call the new subroutine we are going to add.

Then, at the very end of that Class, below all other code, paste the code shown below.

Then, we need to save and compile. Save the Project (File - Save Project). Then save the Class (File - Save DSMapPage.cls). Then create the DLL (File - Make DSMapBookPrj.dll). Save it over the existing file. You may get an error. If so, close the Visual Basic project and then reopen it, then try to create the DLL again - it should work this time. You will need to do this every time you make a change to the code.


Private Sub SelectCR(pmap As IMap, sTileName As String) On Error GoTo ErrHand: Dim pFLayer As IFeatureLayer Set pFLayer = FindLayer("Special Mapbook Layer", pmap) If pFLayer Is Nothing Then Exit Sub End If '---- set the definition query to equal the current tile name Dim pFeatLayerDef As IFeatureLayerDefinition Set pFeatLayerDef = pFLayer pFeatLayerDef.DefinitionExpression = "title = '" & sTileName & "'" Exit Sub ErrHand: MsgBox "SelectCR - " & Erl & " - " & Err.Description End Sub