How to get just MGA Zone from Dynamic Text

505
4
Jump to solution
03-04-2012 08:38 PM
GraemeBrowning
Occasional Contributor III
I'm using Python and ArcPy to automate mapping and have a requirement to project on-the-fly to the appropriate MGA Zone (in Australia) and to report that zone in a text element.

It works well as long as I am happy to use this dynamic text string:

<dyn type="dataFrame" name="Main Map" property="sr" srProperty="name"/>


For example, this will display GDA 1994 MGA Zone 56 when my spatial reference has been set to C:\Program Files\ArcGIS\Desktop10.0\Coordinate Systems\Projected Coordinate Systems\National Grids\Australia\GDA 1994 MGA Zone 56.prj

However, my client has a requirement to just put out zone 56 instead of GDA 1994 MGA Zone 56 and so I have been trying to figure out how to have the Dynamic Text get hold of just the zone 56 part instead.

Two things that I have tried so far are:

  1. Set the name property on the SpatialReference object after creating it to be "zone 56"

  2. Rename the *.prj file to be called "zone 56.prj" before creating the SpatialReference from it


Neither appears to provide a solution.

I could resort to just creating a pseudo-dynamic text element, but before doing that, does anyone know another way to enable a dynamic text element to pull out just the zone number from a spatial reference like this?
0 Kudos
1 Solution

Accepted Solutions
StephenLead
Regular Contributor III
Hi Graeme,

Here is a hack-y version - update the label inside the PRJ file using a text editor.

This seems to work, although it might not be advisable/supported.

Cheers,
Steve

[ATTACH=CONFIG]12501[/ATTACH]

View solution in original post

0 Kudos
4 Replies
JeffBarrette
Esri Regular Contributor
I don't think you can do this with Dynamic Text elements.  You will need to add your own text element and update its value using arcpy.mapping.

Jeff
0 Kudos
GraemeBrowning
Occasional Contributor III
Thanks Jeff

I'll now do it that "pseudo dynamic text" way. 

I'll probably also float this as an ArcGIS Idea to see if it is just me that has been looking for it.
0 Kudos
StephenLead
Regular Contributor III
Hi Graeme,

Here is a hack-y version - update the label inside the PRJ file using a text editor.

This seems to work, although it might not be advisable/supported.

Cheers,
Steve

[ATTACH=CONFIG]12501[/ATTACH]
0 Kudos
GraemeBrowning
Occasional Contributor III
Thanks Steve

I think your workaround should work without any/many side effects as long as the *.prj file gets re-edited with each major upgrade to a new version.  It's certainly simpler than what I do, so will be usable without having to dive into Python, VB, etc.

- Graeme
0 Kudos