9

I'm looking for a way to update the 'layer credits' into a dynamic text box. I've found ways of using the map credits or data frame credits here but can't seem a way to get the information derived from a layer.

I just seem to produce an empty string every time. Has anyone done this or found a work around? Seems like an extremely useful way to update map credits with little to no resources.

Derived Layer properties

  • There is no way to do this dynamically, as the built-in dynamic texts are all based on the document or data frame. However, this is definitely possible if you're willing to run a script to populate a text field every time you make a map. Or, even populate the map credits from all of the layer credits. If this is what you're after, I can provide some arcpy code to do so. – Fezter Jun 13 '16 at 0:47
16
+50

As mentioned in my comment above, there isn't a way to do this using dynamic text. However, you could write a script to do this and attach it to a python addin button or to run when you save the MXD or something. You'll need to create a text element to hold the credits and name it something like "CREDITS" as so:

enter image description here

The basic code would look something like this:

mxd = arcpy.mapping.MapDocument("current")
credit_text = ""
for layer in arcpy.mapping.ListLayers(mxd):
    credit_text += (layer.credits + "\n") # separate each line with a carriage return
for el in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
    if el.name == "CREDITS":
        el.text = credit_text
  • 2
    +1 That's how I'd do it - would have answered with much the same code. – Midavalo Jun 13 '16 at 1:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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