3

I'm writing Python code for ArcGIS using the arcpy library and now I'm experiencing a little problem with labels. In fact I'm not able to rotate them in layout via arcpy (I should rotate all labels of 90 degrees). I found a way to display correct field, round the number, but not to position the label correctly.

9
  • 2
    you can fill a field containing the angle of rotation using arcpy, then make a maplex rule to rotate using that field resources.arcgis.com/en/help/main/10.1/index.html#//…
    – geogeek
    Commented Oct 9, 2012 at 15:16
  • Hi @geogeek , thank you for answering. How can I build a maplex rule for my code? I tried to find something about it.. but I couldn't find anything about the syntax to use.. thanks once again! Commented Oct 9, 2012 at 15:36
  • 1
    As a workaround you could try rotating the labels of your layer and save that as a layer file, then when you need rotated labels for that layer use AddLayer to add the layer file.
    – PolyGeo
    Commented Oct 10, 2012 at 3:01
  • 1
    I just looked at ArcGIS Ideas to see if anyone had already asked for this but no luck. You may want to add a new ArcGIS Idea and post a link here so we can add votes to it.
    – PolyGeo
    Commented Oct 10, 2012 at 3:15
  • 1
    if you have some experience in arcobjects , you can bring arcobjects functions using Ctypes pierssen.com/arcgis10/upload/python/extend_python.pdf
    – geogeek
    Commented Oct 10, 2012 at 14:49

1 Answer 1

3

In response to your comment

if it's possible for example to copy the label style from an external file?

you should be able to just use Save As Layer File to create your *.lyr with rotated labels.

The *.lyr file can be added into your map using arcpy.mapping.AddLayer and then use arcpy.mapping.replaceDataSource to change that layer's source to the dataset whose labels you want to see rotated.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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