Arcview avenue arcgis customization
Download
1 / 37

arcview avenue arcgis customization - PowerPoint PPT Presentation


  • 306 Views
  • Updated 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.

Related searches for arcview avenue arcgis customization

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

PowerPoint Slideshow about 'arcview avenue arcgis customization' - Patman


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 l.jpg
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 l.jpg
Sources for Scripts & Extensions

  • ArcScripts (http://arcscripts.esri.com/)

  • Sample Scripts and Extensions in the ArcView help (look under Sample scripts and extensions in the table of contents)

  • Google

  • Online communities

    • http://www.directionsmag.com/files/

    • http://software.geocomm.com/scripts/arcview/


Installing an extension l.jpg
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 l.jpg
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 l.jpg
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 l.jpg
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 l.jpg
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 l.jpg
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 l.jpg
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 l.jpg

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


Calculators l.jpg
Calculators shut down a project

  • Field calculator (attribute data)

    • Shape calculations

    • Number calculations

    • String calculations

  • Map calculator (raster data)


Field calculator l.jpg

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 l.jpg
Field Calculator the appropriate

  • 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 l.jpg

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 l.jpg
Field Calculator forget the period between

  • 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 l.jpg
Field Calculator Examples forget the period between

  • 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 l.jpg
Field Calculator Examples forget the period between

  • 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 l.jpg

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 l.jpg
Map Calculator Examples select request types from the list

  • 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 l.jpg
Basic Customization in ArcGIS select request types from the list

  • 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 l.jpg
Normal Template select request types from the list

  • 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 l.jpg
Making Your Own Toolbar select request types from the list

  • 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 l.jpg

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

Open the Visual Basic Editor by choosing toolbar by right-clicking on it while the Customize dialog is openTools | 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 l.jpg
Adding a Visual Basic Script toolbar by right-clicking on it while the Customize dialog is open

  • 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 l.jpg
Running a Visual Basic Script toolbar by right-clicking on it while the Customize dialog is open

  • 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 l.jpg
Attaching a Script to a Button toolbar by right-clicking on it while the Customize dialog is open

  • 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 l.jpg
Creating a Tool with Unique Code toolbar by right-clicking on it while the Customize dialog is open

  • 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 l.jpg
Creating a Tool with Unique Code toolbar by right-clicking on it while the Customize dialog is open

  • 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 l.jpg
Keyboard Shortcuts toolbar by right-clicking on it while the Customize dialog is open

  • 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 l.jpg
Basics of Avenue Programming toolbar by right-clicking on it while the Customize dialog is open

  • Basic concepts

  • Classes and objects

  • Avenue requests to find objects

  • Places to get help


Basic avenue concepts l.jpg
Basic Avenue Concepts toolbar by right-clicking on it while the Customize dialog is open

  • 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 l.jpg
Basic Avenue Concepts toolbar by right-clicking on it while the Customize dialog is open

  • 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 l.jpg
Basic Avenue Concepts toolbar by right-clicking on it while the Customize dialog is open

  • 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”)

      myTheme.SetVisible(true)

      Av.FindDoc(“View1”).FindTheme(“Theme1”).SetVisible(true)


Avenue requests to find objects l.jpg
Avenue Requests to Find Objects toolbar by right-clicking on it while the Customize dialog is open

  • 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 l.jpg
Places to Get Help toolbar by right-clicking on it while the Customize dialog is open

  • ArcView Help

  • http://support.esri.com (the User Forums, Knowledge Base, and Downloads sections)

  • Listservs at http://lists.directionsmag.com/discussion/


ad