Sunday, December 20, 2009

AM/FM/GIS

Automated Mapping/Facilities Management Systems seem to have been GIS's older cousin, developed to spatially display and manage attribute information of associated with an infrastructure network (electricity, gas, sewers, etc.).  This type of software is composed of a graphics engine for rendering spatial information combined with a relational database management component.  An example software title is the GE Energy Smallworld suite.

There's a decent history and evolution in this 2003 ESRI white paper:
Utility GIS-More Than Just AM/FM

Also see AM/FM/GIS on Wikipedia

Saturday, December 19, 2009

Quick Zoom Tools


Download the icons & code package:
Custom Zoom Tools.zip

The Bookmarks feature in ArcMap is great for navigating to a saved view, composed of a specific location and scale in a mapping project, however I'm working on a project where I want to zoom to a predefined map scale (1:5,000, 1:30,000, or 1:100,000), but I do not want to change the location.  In this case, Bookmarks are not the answer, so I built three buttons that change the Map Scale with a single click.

Having this single click option saves up to a couple seconds of looking for an appropriate scale each time a button is used instead of scrolling, switching to the Zoom In/Out tools, or typing a scale unit manually.  It would be much faster (especially over the time span of an editing project) to use "map scale bookmarks" to automatically zoom to a predefined level.

Three specific scales are chosen to represent three general views:
  • 1:5,000 is a decent large-scale to use for detailed neighborhood-level observations and to zoom in close enough to get a good look at braided stream segments
  • 1:30,000 is an effective medium-scale to use for viewing larger areas, while the user is still able to distinguish smaller anomalies in a coverage or in imagery
  • 1:100,000 offers a much larger visible area.  For projects that stretch over wide areas, this map scale offers a quick step back to pan across the city/county, etc.
Remember, in cartography "large-scale" refers to larger quotients which are less than, but approach the one.  So as the denominator decreases, scale increases:
  • 1:5,000 = "One-to-five thousand" = 1/5,000 = "One divided by five thousand" = 0.0002
  • Similarily, 1:30,000 = 0.00003
  • 0.0002 > 0.00003, thus 1:5,000 is a larger scale than 1:30,000
  • Further, 1:1 = 1.0, and 1:2 = 0.5, thus 1:1: is larger than 1:2

Installation:
  • Download and unzip the installation package, containing three bitmap icons, and a text file containing the code: Custom Zoom Tools.zip
  • Move the three bitmap files to C:\Program Files\ArcGIS\Bin\Icons or C:\arcgis\Bin\Icons (depending on your installation)
  • Open the text file Custom Zoom Tools Code.txt. Select All and Copy the text.
  • Open ArcMap and load either a saved project or a blank document
  • From the Tools menu, choose Customize.  
  • Navigate to the bottom of the Categories list and select
    [ UIControls ]
  • Make sure that the Save In menu at the bottom left of the Customize dialog is set to Normal.mxt
  • Press the New UIControl button and Create a UIButtonControl.  Repeat this two more times so the Commands list has three new UIButtonControls

    • Slow double click on each of the new button controls in the Commands list to rename them Zoom5k, Zoom10k, and Zoom100k.  The names will automatically change to Normal.Zoom5k, etc. when finished.  The names of these are important and must match exactally to work with the code.
    • Drag these three new button controls onto a desired toolbar (I put mine next to the Map Scale box)
    • With the Customize dialog still open, right click on each button and navigate to Change Button Image :: Browse.  Choose the appropriate icon ("_Zoom5k" etc.) for each button
    • Close the Customize dialog
    Now just paste the code in the correct spot to finish:
    • Open the Visual Basic Editor by pressing Alt + F11, or by navigating to Tools :: Macros :: Visual Basic Editor
    • In the Project Explorer pane, expand "Normal (Normal.mxt)," and "ArcMap Objects" and double click on ThisDocument.

    • A window will open named "Normal.mxt - ThisDocument (Code)."   Scroll to the bottom of this text, add a few lines by hitting enter a few times, and paste all of the code from the text file included in the download above
    • Save this document of code, close the Visual Basic Editor and test the buttons.

    The Code:
    In the following example a few elements are prepared to change the map scale, the map scale is set to 1:5000 (pMap.MapScale = 5000), and the map is refreshed so the new map scale will be visible to the user:

    Private Sub Zoom5k_Click()
    'Change the scale of the current view to 1:5,000

    Dim pMxDocument As IMxDocument
    Dim pMaps As IMaps
    Dim
    pMap As IMap 
    Set pMxDocument = ThisDocument
    Set pMaps = pMxDocument.Maps
    Set pMap = pMxDocument.FocusMap
    pMap.DistanceUnits = esriUnits.esriInches

    pMap.MapScale = 5000

    pMxDocument.ActiveView.Refresh 

    End Sub