Changing scale bar properties with arcpy

4261
7
09-17-2010 07:33 AM
ShannonDeArmond
Occasional Contributor
I'm trying to alter the number of divisions in a scale bar in ArcGIS 10 using Python. I can do it in VBA so it should be possible in Python, right?

An example of why I might want to do this is if I have a set of data-driven pages and the map extent for the set is determined by a data-driven scale, so the scale will be different for each page.

I know I can just set the scale bar to adjust the division value rather than the width, but ArcMap then chooses very awkward division values that are of no help to my field crew who are standing in the middle of nowhere with a ruler trying to figure out how far 50 feet is on the map they're holding. The scales vary too wildly for me to adjust the scale by number of divisions either. I've checked.

So, my office previously had a VBA script that would look at the scale of a map and adjust the scale bar divisions and division numbers based on a list of predetermined scale ranges. Like a good ArcGIS 10 user, I'm trying to recreate this in Python. I understand how to get to the scale bar as a MapsurroundElement to adjust its width or move it around on the page, but is there a way to get to the division values?
0 Kudos
7 Replies
JohnHauck
Occasional Contributor II
Arcpy is still more limited in scope than what you can do with VBA. I don't see a way to do this currently with arcpy. Please contact support and log an enhancement request for this.
0 Kudos
ShannonDeArmond
Occasional Contributor
I posted an enhancement request on the ideas board.  If you have this problem too, go vote for it.
0 Kudos
SumantMallavaram
New Contributor II
I came across the same problem 2 days ago for the first time. I have spoken to 2 Esri reps here at the UC 2011 and they have both promised to follow up and submit an enhancement request and get back to me. I was told ArcPy doesn't expose all the objects in a layout view and therefore ArcObjects would be the only way to do it for now. My request to them was to simply have a check box in the scale bar properties that can be toggled "on" if you want the scale bar division set equal to the scale of the layout coming in from the attribute table in  my case for each page.

In the meantime, did you ever figure out a workaround and if so could you please share it with me.

Could you also please repost the link to your enhancement request?  I would like to bump it up if I could.
0 Kudos
GraemeBrowning
Occasional Contributor III
I have the same requirement and so voted for the aforementioned ArcGIS Idea here.
0 Kudos
George_ChandeepCorea
New Contributor III
Same issue -upvoted sbyrne's post and the one in arc ideas. It is a huge issue with the only current workaround being to create new mxd's which only have pages of the same scale and the related issue is with the alignment of the scale bar/text where 1:10,000 and 1:100,000 for example don't get properly centered with the N arrow or other elements and this means having to left align or create new mxd's for each page which defeats the productivity gains of DDP.


George Corea

GIS/Conservation Specialist
0 Kudos
GraemeBrowning
Occasional Contributor III
Thanks for endorsing this issue George

I think that ArcPy not being able to modify a grid/graticule interval (and not even being able to delete a grid/graticule) is the biggest impediment I currently have when working with ArcGIS.

Thankfully, the second (scale bar alignment) issue you mention seems to have been resolved at 10.1 but for me that was a minor inconvenience compared to the above.

- Graeme
0 Kudos
George_ChandeepCorea
New Contributor III
No problem Graeme - BTW I also posted it at http://gis.stackexchange.com/questions/23375/acrpy-ddp-alter-graticule-logically-in-varying-map-scal... as I was hoping that there would be an answer to this after SP4

BTW I found that the centering issue can be resolved by grouping all the items once they are centered properly at one scale.

best
0 Kudos