Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm relatively new to GIS and looking to automate a project. I have my 'base map' created in ArcGIS, but now need to create several hundred more so looking for an automated method to accomplish this. I have a desktop version of ArcGIS 9.3. I'm currently using VB, Python isn't installed and will require going through IT and business case...

Things I need to figure out: 1. Select the Area of Interest (Polygon) 2. Zoom to the select area 3. Change title 4. Change legend to add some details (can be either the layer name or the description for the layer). 5. Export to PDF.

I have figured out #1, but stuck on #2, because although it does zoom to the polygon of interest it isn't choosing the same zoom I'd get if I manually clicked "Zoom to Selected Features".

Any suggestions on things I should look into or resources?

Thanks, Reese

share|improve this question

3 Answers 3

up vote 0 down vote accepted

I use DDP Then I set up several fields in my data.

*page name, page number, rotation, ref_scale, scale, page_on.*

I use these to manage the zoom scale and reference scale on each page. Most of them go in the data driven pages dialog. Page_on I use to limit the objects (by query) that will generate pages.
BTW: You can use line features as the index layer.
Then utilize the scale on the extent tab to get the zoom you are talking about.
Then a template layout with Just about anythingyou can think of as marginalia can be used by setting dynamic text, enable match/don't match in the page definition, dynamic legend. and more.

data driven pages

Then when you print you use the all pages option to either export to pdf or print.

Export pages

share|improve this answer
    
Um, aren't Data Driven Pages only available in ArcGIS 10.x? I remember having to do a lot of VB programming to accomplish something similar in 9.x. –  Baltok Dec 5 '12 at 17:48
    
9.x it was called dsmapbook. you didn't have to do any programming but did have to load the dll. 10.0 it is called data driven pages. 10.1 ddp is VERY usable. OP did not indicate a version of arcgis. –  Brad Nesom Dec 5 '12 at 20:06
    
Thanks Brad! I don't have install rights though, so it doesn't seem to work. Is there a way to add all the code to a project? –  Reese Dec 5 '12 at 21:19
    
You cannot change #4 with dsmapbook, you'll have to use ArcObjects for that. –  artwork21 Dec 6 '12 at 2:17

If you are using the ArcObjects/VBA macro in ArcMap approach you can do the following (sorry some of the code examples are in .NET, but the idea is the same):

for number 2 use ArcMap Command Zoom to Selected Features:

 Dim pUID As New UID
 Dim pCmdItem As ICommandItem
 Dim pApp As IApplication
 ' Use the GUID of the Save command
 pUID.Value = "esriArcMapUI.ZoomToSelectedCommand"
 pUID.SubType = 3
 pCmdItem = pApp.Document.CommandBars.Find(pUID)
 pCmdItem.Execute()

for number 3:

            Dim pLayoutS As IPageLayout2
            Dim pGCS As IGraphicsContainer
            Dim pTS As ITextElement
            Dim pAvS As IActiveView
            Dim pElPropS As IElementProperties
            Dim pElementS As IElement

            pLayoutS = CType(m_pMxDoc2.PageLayout, IPageLayout2)
            pGCS = CType(pLayoutS, IGraphicsContainer)
            pAvS = CType(pLayoutS, IActiveView)

            pGCS.Reset()
            pElementS = pGCS.Next

            'Get existing date graphic and update time and date.
            Do Until pElementS Is Nothing
                pElPropS = CType(pElementS, IElementProperties)
                If pElPropS.Name = "Current Text" Then
                    pTS = CType(pElementS, ITextElement)
                    pTS.Text = "New Text"
                    pAvS.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pElementS, Nothing)
                End If
                pElementS = pGCS.Next
            Loop

for number 4, can you turn off the layers that you do not want to show in the legend:

            Dim pMap As IMap = Nothing
            Dim pLayer As ILayer
            Dim pGroupLayer As IGroupLayer = Nothing
            Dim i As Integer

            Dim pGrphcon As IGraphicsContainer = Nothing
            Dim pElem As IElement = Nothing
            Dim pTxtElem As ITextElement = Nothing
            'Dim pElPropS As IElementProperties
            Dim pAvS As IActiveView = Nothing
            Dim pPageLayout As IPageLayout

            pPageLayout = m_pMxDoc2.PageLayout
            m_pMxDoc2.ActiveView = pPageLayout

            pMap = m_pMxDoc2.FocusMap

            Dim pContentsView As IContentsView
            pContentsView = m_pMxDoc2.CurrentContentsView

            For i = 0 To pMap.LayerCount - 1
                If pMap.Layer(i).Name = "My Layer to turn off" Then
                    pLayer = pMap.Layer(i)
                    If TypeOf pLayer Is IGroupLayer Then
                        pGroupLayer = pLayer
                        pContentsView.SelectedItem = pLayer
                        'Turn off layer here in TOC
                        pGroupLayer.Visible = False

                        strLayerName = pLayer.Name

                        m_pMxDoc2.UpdateContents()
                        m_pMxDoc2.ActiveView.Refresh()

                    End If
                End If
            Next i

for number 5:

See this example - Export Active View to JPEG

share|improve this answer

you should use Arcobject and programming using C#, VB.net and other programming language that support Arcobject.

share|improve this answer
    
Your answer is valid, however not very clear on what objects to use and how to run the macro. –  artwork21 Dec 6 '12 at 1:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.