arcview avenue arcgis customization l.
Skip this Video
Loading SlideShow in 5 Seconds..
ArcView / Avenue / ArcGIS Customization PowerPoint Presentation
Download Presentation
ArcView / Avenue / ArcGIS Customization

Loading in 2 Seconds...

play fullscreen
1 / 37

ArcView / Avenue / ArcGIS Customization - PowerPoint PPT Presentation

  • Uploaded on

ArcView / Avenue / ArcGIS Customization. Basic Customization in ArcView 3.x. Sources for scripts and extensions Installing an extension Adding and running a script Attaching a script to a button System scripts Startup and shutdown scripts. Sources for Scripts & Extensions.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

ArcView / Avenue / ArcGIS Customization

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
basic customization in arcview 3 x
Basic Customization in ArcView 3.x
  • Sources for scripts and extensions
  • Installing an extension
  • Adding and running a script
  • Attaching a script to a button
  • System scripts
  • Startup and shutdown scripts
sources for scripts extensions
Sources for Scripts & Extensions
  • ArcScripts (
  • Sample Scripts and Extensions in the ArcView help (look under Sample scripts and extensions in the table of contents)
  • Google
  • Online communities
installing an extension
Installing an Extension

On a Windows machine:

  • Put the .avx file in the c:\esri\av_gis30\arcview\ext32 directory
  • You can also set the USEREXT environment variable to use another location (if you have admin privileges)
installing an extension5
Installing an Extension

On our UNIX system:

  • Putting the .avx file in your home directory should make ArcView see it when you are logged in
  • Or you can set an environment variable called USEREXT to point to a custom location and then put all your .avx files in that location
  • Only the system administrator can install an extension so all users can see it
adding a script
Adding a Script
  • In the ArcView Project window, select the Scripts icon and then click New
  • Either type, paste, or use the Script | Load Text File option to get your code in the new script window
  • Use Script | Compile or the checkbox button to compile the script
  • If you don’t get an error message, then the script compiled successfully
running a script
Running a script
  • Some scripts can be run from the project window, just by clicking Run
  • Others might need to be associated with a particular (open) document, like a view
  • To associate a script with a view:
    • Open the script
    • Activate the necessary view
    • Activate the script
    • Choose Script | Run
running a script8
Running a script
  • A better way to make a script work with a view if you’re going to use it a lot is to put a new button on the View toolbar and associate it with the script
    • Make a view active
    • Double-click on an empty part of the toolbar
    • Make sure Type is View and Category is Buttons
    • Select a button and click New (this will create a new button next to the one you selected)
running a script9
Running a Script
  • Select your new button
  • Double-click on the empty box next to Click (in the bottom part of the dialog)
  • Select the script you want to run
  • You can also set an icon for the button by double-clicking on the Icon section at the bottom of the Customize dialog
system scripts
System Scripts
  • A lot of the scripts written by ESRI are available for you to use
  • Use the customize dialog to see what script gets run by a button or menu item
  • You can attach system scripts to your own custom buttons
startup and shutdown scripts
You can make a script automatically run when you open or shut down a project

Choose Project | Properties

Set scripts using the script selection buttons

You can also set a working directory and a selection color using this dialog

Startup and Shutdown Scripts
  • Field calculator (attribute data)
    • Shape calculations
    • Number calculations
    • String calculations
  • Map calculator (raster data)
field calculator
To see a list of requests available for a data type, click the appropriate Type radio button and then scroll down the Requests list

The example shown here converts a numeric ID to a string and puts it in a new field called NewField1

Field Calculator
field calculator14
Field Calculator
  • Operations on shapes are not shown in the Field Calculator itself
  • To see what shape requests are available, open the ArcView help and go to the Shape (class) entry in the index
  • You can’t use everything that is listed, but you can use the ones that return a number, string, or boolean and don’t require another shape (so you can use ReturnArea but not Contains)
field calculator15
You’ll have to type the request in yourself (don’t forget the period between [Shape] and the request!)

This example computes the area of a shape (polygon) and puts it in a field called NewField1

Field Calculator
field calculator16
Field Calculator
  • Descriptions of all requests are in the ArcView help; either search on the name of the request you see in the dialog, or go to the following pages in the index to see a list of them all:
    • Shape (class)
    • Number (class)
    • String (class)
    • Date (class)
field calculator examples
Field Calculator Examples
  • Autonumber records: rec + 1
  • Convert a number to string: [num].AsString
  • Concatenate two string fields into one:
    • [str1] + [str2] (no space)
    • [str1] ++ [str2] (space between originals)
  • Extract first 3 characters from a string: [str].Left(3)
field calculator examples18
Field Calculator Examples
  • Convert a number to a string: [num].AsString
  • Compute absolute value of a number: [num].Abs
  • Get the maximum of two numeric fields: [num1] max [num2]
map calculator
Double-click on a grid name and then you’ll be able to select request types from the list

Use the AsGrid request to convert numbers to grids

This example takes the base10 log of Grid1 and then adds 5 to that

Map Calculator
map calculator examples
Map Calculator Examples
  • Create a grid that has true everywhere grid1 is NULL and false where grid1 has data: [grid1].IsNull
  • Create a grid that has values from grid1 where grid3 is non-zero and values from grid2 everywhere else: [grid3].Con([grid1],[grid2])
  • Mosaics 3 grids together: [grid1].Mosaic({[grid2],[grid3]})
  • Check out the Grid (class) section in the help to see more requests
basic customization in arcgis
Basic Customization in ArcGIS
  • Normal template
  • Making your own toolbar
  • The Visual Basic Editor
  • Adding and running a Visual Basic script
  • Attaching a script to a button
  • Keyboard shortcuts
normal template
Normal Template
  • Stores information (including customizations) for the ArcGIS application
  • Anything saved in normal.mxt is available in all map documents
  • Make sure you save customizations in the correct place (normal.mxt for global customizations, your .mxd file for project-specific customizations)
making your own toolbar
Making Your Own Toolbar
  • Open the Customize dialog by either double-clicking on an empty spot in the toolbar or choosing Customize from the Tools menu
  • Go to the Toolbars tab and click New
  • Name your toolbar and choose the location to save it
  • Your new toolbar will open when you click OK
making your own toolbar24
You can change the tooltip or icon, or delete a tool on your toolbar by right-clicking on it while the Customize dialog is open

Go to the Commands tab in the Customize dialog

Drag the commands you want onto your toolbar

Making Your Own Toolbar
the visual basic editor
Open the Visual Basic Editor by choosing Tools | Macros | Visual Basic Editor

The Project window shows all of the code VB code available in the current project

Code can be in normal.mxt or in the current project

Code that you’re adding will most likely be in a regular Module

The Visual Basic Editor
adding a visual basic script
Adding a Visual Basic Script
  • Open the Visual Basic Editor
  • Right-click on one of the Module folders and either import the file or insert a new Module
  • If you didn’t import the file, paste the code into the new Module
  • Make sure the code compiles by choosing Debug | Compile Project
running a visual basic script
Running a Visual Basic Script
  • From the Visual Basic Editor, choose Run | Run Sub/UserForm while your cursor is in the procedure you want to run
  • From ArcMap, open the Macros dialog by choosing Tools | Macros | Macros, and then select the procedure you want to run and click Run
attaching a script to a button
Attaching a Script to a Button
  • Open the Customize dialog
  • Go to the Commands tab
  • Go to the Macros category
  • Drag the macro you want to attach to a toolbar
  • Right-click on your new tool to change tooltips and icons
creating a tool with unique code
Creating a Tool with Unique Code
  • Sometimes you might want to create a button that runs code specific to it (rather than contained in a separate module)
  • Open the Customize dialog and go to the Commands tab
  • Select the UIControls category and click New UIControl
  • Make sure UIButtonControl is selected and click Create
creating a tool with unique code30
Creating a Tool with Unique Code
  • You can change the name of your control by clicking on it twice (slowly)
  • Drag the tool to a toolbar
  • Right-click on the new button and choose View Source in order to view (and edit) the code
keyboard shortcuts
Keyboard Shortcuts
  • Open the Customize dialog and click on the Keyboard button
  • Select the command you want to create a shortcut for
  • Put your cursor in the Press new shortcut key box and press the key combination you want to use
  • You will see if that combination is already assigned (Currently assigned to section)
  • If you want to use that combination, click Assign
basics of avenue programming
Basics of Avenue Programming
  • Basic concepts
  • Classes and objects
  • Avenue requests to find objects
  • Places to get help
basic avenue concepts
Basic Avenue Concepts
  • Object oriented, which means you have a collection of objects that you send requests to
  • There are many classes of objects (views, themes, etc), and more than one object of each class can exist
  • Think of a particular object as a (really smart) variable and its class as a data type
basic avenue concepts34
Basic Avenue Concepts
  • An object is smart enough to do its own processing, which is why you send requests to it (you tell a theme to turn itself on, for example, rather than telling the main ArcView application to turn a specific theme on)
  • Before you can do any processing, you need to get a “handle” to the object you want to do processing on
basic avenue concepts35
Basic Avenue Concepts
  • For example, if you want to turn a theme on, you:
    • Find the View
    • Find the Theme
    • Make the theme visible

myView = Av.FindDoc(“View1”)

myTheme = myView.FindTheme(“Theme1”)



avenue requests to find objects
Avenue Requests to Find Objects
  • To find a view:

myView = Av.FindDoc(“view_name”)

  • To find a theme:

myTheme = myView.FindTheme(“theme_name”)

  • To get a vector theme’s attribute table:

myTable = myTheme.GetFTab

  • To get a field in an attribute table:

myField = myTable.FindField(“field_name”)

places to get help
Places to Get Help
  • ArcView Help
  • (the User Forums, Knowledge Base, and Downloads sections)
  • Listservs at