Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6926551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:55:58+00:00 2026-05-27T10:55:58+00:00

I am trying to work out a way to change between two sets of

  • 0

I am trying to work out a way to change between two sets of labels on a map. I have a map with zip codes that are labeled and I want to be able to output two maps: one with the zip code label (ZIP) and one with a value from a field I have joined to the data (called chrlabel). The goal is to have one map showing data for each zip code, and a second map giving the zip code as reference.

My initial attempt which I can’t get working looks like this:
1) I added a second data frame to my map and add a new layer that contains two polygons with names “zip” and “chrlabel”.
2) I use this frame to enable data driven pages and then I hide it behind the primary frame (I don’t want to see those polygons, I just want to use them to control the data driven pages).
3) In the zip code labels I tried to write a VBScript expression like this pseudo-code:
test = “
If test = “zip” then
label = ZIP
else
label = CHRLABEL
endif

This does not work because the dynamic text does not resolve to the page name in the VBScript.
Is there some way to call the page name in VBScript so that I can make this work?

If not, is there another way to do this?
My other thought is to add another field to the layer that gets filled with a one or a zero. Then I could replace the if-then test condition with if NewField = 1.

Then I would just need to write a script that updates all the NewFields for the zipcode features when the data driven page advances to the second page. Is there a way to trigger a script (python or other) when a data driven page changes?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:55:58+00:00Added an answer on May 27, 2026 at 10:55 am

    8 months too late, but for posterity…

    You’re making things hard on yourself – it would be much easier to set up a duplicate layer and use different layers, then adjust layer visibility. I’m not familiar with VBScript for this sort of thing, but in Python (using ESRI’s library) it would look something like so [python 2.6, ArcMap 10 – sample only, haven’t debugged this but I do similar things quite often]:

    from arcpy import mapping
    
    ## Load the map from disk
    mxdFilePath = "C:\\GIS_Maps_Folder\\MyMap.mxd"
    mapDoc = mapping.MapDocument(mxdFilePath)
    
    ## Load map elements
    dataFrame = mapping.ListDataFrames(mapDoc)[0]   #assumes you want the first dataframe; you can also search by name
    mxdLayers = mapping.ListLayers(dataFrame)
    
    ## Adjust layers
    for layer in mxdLayers:
        if (layer.name == 'zip'):
            zip_lyr = layer
        elif(layer.name == 'sample_units'):
            labels_lyr = layer
    
    ## Print zip code map
    zip_lyr.visible = True
    zip_lyr.showLabels = True
    labels_lyr.visible = False
    labels_lyr.showLabels = False
    
    zip_path = "C:\\Output_Folder\\Zips.pdf"
    mapping.ExportToPDF(mapDoc, zip_path, layers_attributes="NONE", resolution=150)
    
    ## Print labels map
    zip_lyr.visible = False
    zip_lyr.showLabels = False
    labels_lyr.visible = True
    labels_lyr.showLabels = True
    
    labels_path = "C:\\Output_Folder\\Labels.pdf"
    mapping.ExportToPDF(mapDoc, labels_path, layers_attributes="NONE", resolution=150)
    
    ## Combine files (if desired)
    pdfDoc = mapping.PDFDocumentCreate("C:\\Output_Folder\\Output.pdf"")
    pdfDoc.appendPages(zip_path)
    pdfDoc.appendPages(labels_path)
    pdfDoc.saveAndClose()
    

    As far as the Data Driven Pages go, you can export them all at once or in a loop, and adjust whatever you want, although I’m not sure why you’d need to if you use something similar to the above. The ESRI documentation and examples are actually quite good on this. (You should be able to get to all the other Python documentation pretty easily from that page.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to work out a way of passing the web current http context
Ok, so im trying to work out the fastest way of storing data on
I've been trying to work out the 'best practices' way to manage file uploads
I am trying to work out a way of changing the belongs_to, has_many relationship
Hi I have the following problem and I am trying to work out what
I am trying to work out a good way to run a staging server
I am trying to work out a way to alter the session timeout dynamically,
I am trying to work out the best way to represent the concept of
I am trying to work out the best way to replace multiple variables/placeholders within
Using XSLT I'm trying to work out a way to only emit a HTML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.