Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
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 Oct 9 '12 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! –  Annalisa Minelli Oct 9 '12 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 Oct 10 '12 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 Oct 10 '12 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 Oct 10 '12 at 14:49

1 Answer 1

up vote 2 down vote accepted

This Question is quite old but I've only just seen 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.

share|improve this answer
    
.lyr files don't store labeling. You'd have to make the custom label style in your user .stlye file then import that onto the feature layer. –  DPierce Jun 7 '13 at 13:08
    
That does not sound right but its late here so I will double-check tomorrow. –  PolyGeo Jun 7 '13 at 13:10
    
I ran through it in ArcMap 10.0 SP5 before I posted, and it didn't take the labeling. –  DPierce Jun 7 '13 at 13:12
    
Using ArcMap 10.0 SP5, I just got label angles of 45 on points to save into a *.lyr file, that I then added to a new map where I saw those angles preserved. I suspect we may be talking about different techniques so now that I know there is still interest in this Q&A I will list the steps of mine in more detail. –  PolyGeo Jun 7 '13 at 23:09
    
Confirmed you are correct. The more you know. –  DPierce Jun 10 '13 at 14:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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