I am building annotation features with Python/comtypes/ArcObjects. The annotation works great in ArcMap (10.1), but it is does not draw when published to a map service in ArcGIS Server. Each piece of annotation consists of one or more graphic shapes (GraphicElement), usually rectangles, and one or more graphic text objects (TextElement) on top of those graphics, all grouped together in a GroupElement. The GroupElement is what is stored in the annotation. The image below shows three pieces of annotation, two with graphic rectangle backgrounds and one containing only a TextElement. We thought the problem was with the custom font that contains the arrow characters, but that seems to be fine. The screen shot is from ArcMap. When the annotation you see here is published to a map service, only the plain annotation feature without the colored background draws in the service. The more complex annotation does not, so the problem would appear to be with the presence of both GraphicElement and TextElement objects in the same annotation feature or with the fact that the element stored is a GroupElement. (As far as I know, an annotation feature can only store a single element, hence the grouping of all the components first.)
Might anyone have some insights as to why the complex annotation is not drawing? When I started, many moons ago, to build the scripts to make the annotation this way, there was no intention, at least on my part, to deploy any of this on a map service. In fact, I know little about map services and their particular idiosyncrasies. I was writing strictly for data production in ArcMap to fill a need for building and storage of specialized graphical information in a geodatabase. The annotation solution worked so well that the powers that be have now run with it and are trying to use the annotation in map services and web apps. I am way outside of my comfort zone here, as my scripts have been converted to .NET and deployed in web apps, and I haven't had much to do with any of that. What I know is that the annotation works wonderfully in ArcMap but doesn't in a map service. Any ideas here would be much appreciated.
UPDATE: I don't have access to the map service in question here, and my boss is doing the testing here and there between flights. My information is rather second hand; however, I might have another clue. (What it means, I'm not sure). There are other annotations that do render OK. One type is "graphic-only" built from multiple graphic shapes that are grouped together and stored in the annotation. The other is stop signs. These signs are built from one graphic shape and one text box containing the word "STOP." The difference between the stop sign and the other complex annotation features already discussed (which do not render) is that the text box uses only one font, Arial to be exact. The non-rendering complex annotations access both Arial (for the letters) and our custom font (for the arrows and other symbols). So, the annotations that are not rendering are the ones (1) built from both graphics and text boxes and (2) where the text boxes access multiple fonts. Both these conditions are necessary apparently to cause non-rendering. The plain annotation in the screenshot - which does render correctly - accesses both fonts but does not have a graphic. (Unfortunately, most of our annotation meets the above two non-rendering criteria.)
Also, I have seen one maybe solution that involves moving the annotation layer to its own service using ArcGISDynamicMapServiceLayer. Does this make any sense to anyone?
UPDATE 2: After much testing and some expert help from ESRI through the forums, a cause for the map service misbehavior was found. It appears that an ESRI optimized map service cannot handle nested groups, i.e. groups within groups. The ESRI programmer who helped me is of the opinion that this shortcoming is a bug and is going to try to register it as such. I will next try to build our annotation without grouping any graphics until finally grouping all of them together after all parts are constructed. That way there is only the one overall GroupElement for the whole sign that is required for storage in the annotation. I'll update again with my results.