intro to arcmap customization with visual basic create your own toolbars, buttons, interactive...

22
Intro to ArcMap Customization with Visual Basic Create your own toolbars, buttons, interactive tools, and programs Runs behind the scenes in ArcMap Supported by extensive web help center Great addition to GIS skills on a resume

Post on 20-Dec-2015

244 views

Category:

Documents


14 download

TRANSCRIPT

Page 1: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Intro to ArcMap Customizationwith Visual Basic

Create your own toolbars, buttons, interactive tools, and programs

Runs behind the scenes in ArcMap Supported by extensive web help center Great addition to GIS skills on a resume

Page 2: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

The ArcMap Interface

Powerful but complicated Many tasks require a multitude of steps Capabilities buried within many different toolbars Editing. Enough said.

Unfortunately Many organizations do just a couple of set tasks and

they do them often Many personnel / users who might benefit from simple

and straightforward GIS use are not trained in ESRI products Time (training, familiarization) is a limited resource

Page 3: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

ArcMap Interface cont.

ArcMap (and more) can be customized to incorporate tools that: Provide shortcuts to common tasks Aggregate multiple steps into one click Simplify the built-in ESRI interfaces and tailor

them to the problem at hand

Page 4: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Yet more ArcMap Interface

ESRI provides an extremely comprehensive object library for its GIS components

All components you see here in ArcMap can be accessed behind the scenes

Page 5: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Adding Your Own CommandsFirst Steps

Start with a new toolbar Add new ‘UIControls’

Buttons Tools Combo Boxes Edit Boxes

Right-click and add code! Well…not quite that simple

Page 6: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Right-click toolbar area Scroll to bottom and

click ‘Customize’

Page 7: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Select ‘New’ toolbar Enter name Choose to save inside your

mxd file

Your new, empty toolbar appears on the screen

Page 8: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Now add controls Click the ‘Commands’ tab

and scroll to bottom of categories

Click ‘New UIControl’ Select the type of control

Page 9: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Style Controls Click on the control in the

list to give it a new name. When finished, click and

drag the control onto toolbar

Right-click control on toolbar to change label, icon, and specify display options (image only, etc)

Page 10: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Code Window

Also right-click control to specify behavior via code window

Page 11: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Use the ESRI Developer Network to find code examples

Page 12: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap
Page 13: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Many programming languages are supported in ArcGIS

Finding the examples you need for VBA will take some practice

Page 14: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

VBA Code for Selecting Features

Page 15: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

VBA Code 2

Sets up objects for a layer, the map doc, and the main map

Connects the new objects to your open map document, the first data frame, and the first layer in the list

Sets up query object & specify conditions Sets up selection set object

Assigns the selection set to the results of the select query

Page 16: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Example map document and customized toolbar with 3 specialized buttons

Page 17: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

The Zoom to Full Extent button always takes you to the extent of the largest layer

However…

Page 18: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

You can create a button that zooms exactly to a certain spot as a shortcut

Or a button that selects a subset of features of interest without the user having to specify the select by attribute query

Page 19: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Classroom Finder 1

You can tell a button to load a specialized form that takes input, then does processing that you specify in code.

Page 20: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Classroom Finder 2

Restrict input to options in drop-down boxes . . .

Page 21: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Classroom Finder 3

You can simplify a query, and then condense the query, zooming, and display of the results as you choose

Beginnings of a classrom finder?

Page 22: Intro to ArcMap Customization with Visual Basic  Create your own toolbars, buttons, interactive tools, and programs  Runs behind the scenes in ArcMap

Wrap-Up

Familiarization will require some experimentation, but very rewarding

Full libraries, discussion forums, and code examples online at: http://edn.esri.com/index.cfm?fa=docLibrary.gateway

Multiple programming languages supported VB, VB.NET, C, C++, Java