Does anyone know how to modify the location of a label programmatically?
I'd like to make the labels sit directly below the symbol!
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
I've never tried this, but from the documentation it doesn't appear possible to change a layer's label positioning properties using arcpy.
The layer class provides access to that layers' labelClass - but from what I can see, this only gives the option to toggle labels on/off, change the expression, and set SQL queries. It doesn't appear to give access to the label positioning options.
You may need to resort to ArcObjects in order to access the full set of labelling properties. As the Introduction to arcpy.mapping document says:
Arcpy.mapping is not a replacement for ArcObjects but rather an alternative for the different scenarios it supports. ArcObjects is still necessary for finer-grain development and application customization, whereas arcpy.mapping is intended for automating the contents of existing map documents and layer files.
Edit: I haven't tried using ArcObjects to adjust the label placement, but it seems the ILabelEngineLayerProperties2 interface is the place to look. This interface has a property BasicOverposterLayerProperties which allows you to "specify how labels are placed relative to features."
The documentation from this point is a bit light/non-existent so you may need to do some experimentation.