Automating Standard Maps Using ArcObjects - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

Automating Standard Maps Using ArcObjects

Description:

Chief Cartographer. Virginia Economic Development Partnership. 2006 Virginia GIS Conference ... Application finds polygon and zooms to it. ... – PowerPoint PPT presentation

Number of Views:147
Avg rating:3.0/5.0
Slides: 30
Provided by: mada47
Category:

less

Transcript and Presenter's Notes

Title: Automating Standard Maps Using ArcObjects


1
Automating Standard Maps Using ArcObjects
  • Mary Davis
  • Chief Cartographer
  • Virginia Economic Development Partnership
  • 2006 Virginia GIS Conference
  • Richmond, VA

2
Automating Standard Maps
  • Example of Application
  • Outline of Methodology
  • Sample Code
  • Obstacles and Successes
  • Demonstration of Similar Applications

3
Demonstration of Application
  • Basically the application runs queries.
  • User inputs value (site number).
  • Application finds polygon and zooms to it.
  • Looks up matching fields in database to fill out
    text elements.
  • Also takes County FIPS from database and zooms to
    county in inset data frame.

4
(No Transcript)
5
(No Transcript)
6
(No Transcript)
7
(No Transcript)
8
Outline of Methodology
  • Resources
  • ESRI Training Introduction to Programming
    ArcObjects with VBA
  • Visual Basic Course before ESRI course
  • Books
  • Getting to Know ArcObjects Programming ArcGIS
    with VBA, by Robert Burke, from ESRI Press
  • Database Access Visual Basic 6, by Jeffrey
    McManus
  • ArcObjects Online Forums

9
Outline of Methodology
  • Set up map in ArcMap the way you want it.
  • Determine what can be static and what needs to be
    modified.
  • Design Visual Basic forms for user interface.
  • Write code or borrow and modify to fit your
    specific ideas and your data (See resources).
  • Test and debug.
  • Put into operation.

10
Outline of Methodology
  • Within code
  • Declare variables for
  • Map document
  • Data frames
  • Layers that will be modified
  • User input
  • Query statements and definition expressions
  • Selection sets
  • Text elements
  • Active View

11
Outline of Methodology
  • Use variable from user input to make a query
    string
  • Set site layer definition expression property
    to query string
  • Select site based on site number then check to
    see if it exists in database
  • Zoom in on site
  • Search database for fields that contain county
    FIPS and text for text elements
  • Extract data from those fields and put into
    variables
  • Use similar code for other data frames (county
    state insets)

12
Sample Code
  • Declare variables for map document
  • All ArcObjects applications start out with
  • Dim pMxDoc As esriArcMapUI.IMxDocument
  • Set pMxDoc ThisDocument
  • Dim pMaps As esriCarto.IMaps
  • Set pMaps pMxDoc.Maps
  • Set the query statement
  • Dim strQuery As String
  • Dim pSiteNo As String
  • pSiteNo VBA.StrConv(txtSiteNo.Text,
    vbUpperCase)
  • strQuery "SITE_NO " pSiteNo
    "
  • pSiteLayerDef.DefinitionExpression strQuery

13
(No Transcript)
14
Sample Code
  • Select site and check to see if it exists
  • pFilterSite.WhereClause strQuery
  • pFeatureSelection.SelectFeatures
    pFilterSite, esriCarto.esriSelectionResultNew,
    True
  • If (pFeatureSelection.SelectionSet.Count 0)
    Then
  • MsgBox "The site number you have entered
    does not exist."
  • Exit Sub
  • End If
  • pFeatureSelection.Clear

15
Sample Code
  • Zoom in on site
  • Dim pSiteActiveView As esriCarto.IActiveView
  • Set pSiteActiveView pSiteMap
  • pSiteActiveView.Extent pSiteLayer.AreaOfInte
    rest
  • Dim pEnvelope As esriGeometry.IEnvelope
  • Set pEnvelope pFeature.Extent
  • pSiteActiveView.Extent pEnvelope
  • pSiteMap.MapScale 24000
  • pSiteActiveView.Refresh
  • Repeat process with other data frames

16
Sample Code
  • Search database for correct fields for text
    elements
  • Dim Y As Long
  • Y pFCursor.FindField("sde_vector.SDE_EDIT.SI
    TES.FIPS")
  • Dim W As Long
  • W pFCursor.FindField("sde_vector.dbo.v_AllPr
    operties.PropertyName")
  • If W -1 Then
  • MsgBox "Cannot find site name. Exiting
    program.
  • End If
  • .
  • Dim siteName As String
  • Dim countyName As String
  • Dim FIPScode As String
  • siteName pFeature2.Value(W)
  • countyName pFeature2.Value(Z)
  • FIPScode pFeature2.Value(Y)
  • 'Create county and site point query statements
  • Dim strCountyQuery As String
  • strCountyQuery "CFIPS '" FIPScode "'"

17
Sample Code
  • Put text into text elements
  • Do Until pElementProp Is Nothing
  • Select Case pElementProp.Name 'Case to
    see if element is title, subtitle, or date
  • Case "StandardMapTitle"
  • Set pTextElement pElementProp
  • pTextElement.Text siteName
  • Case "StandardMapSubtitle"
  • Set pTextElement pElementProp
  • pTextElement.Text countyName
  • Case "StandardMapSubtitle2"
  • Set pTextElement pElementProp
  • pTextElement.Text pSiteNo
  • Case "StandardMapDate"
  • Set pTextElement pElementProp
  • pTextElement.Text
    VBA.FormatDateTime(Now, vbShortDate)
  • End Select
  • Set pElementProp pGraphics.Next
  • Loop

18
Sample Code
  • Refresh
  • Dim pActiveView As esriCarto.IActiveView
  • Set pActiveView pGraphics
  • pActiveView.PartialRefresh esriCarto.esriViewGrap
    hics, Nothing, Nothing

19
Obstacles and Successes
  • Visual Basic is a complex language.
  • Revising the program to use points for the
    Buildings layer rather than Site polygons was
    difficult.
  • Getting the Title to fit in the Legend was a
    challenge.
  • We entered everything in SDE for easy
    transferability to other users.
  • We set up views of SQL tables to join to the
    Sites layer for easy database queries.

20
Examples of Similar Applications
  • Standard map showing regions.
  • Program that RIPs a PDF of a standard map of each
    site in the database.

21
(No Transcript)
22
(No Transcript)
23
(No Transcript)
24
(No Transcript)
25
(No Transcript)
26
(No Transcript)
27
(No Transcript)
28
(No Transcript)
29
Questions
  • Mary Davis
  • Virginia Economic Development Partnership
  • 804-545-5686
  • madavis_at_yesvirginia.org
Write a Comment
User Comments (0)
About PowerShow.com