Select to view content in your preferred language

Annotation layer shows up as black boxes

3728
4
11-17-2015 03:18 PM
Choon_VuLam
Emerging Contributor

I have an non-feature linked annotation layer that has been published as a service, and I have added it to my JavaScript App using esri.layers.FeatureLayer. However, it doesn't display properly and only shows up as black boxes (see screenshot below).

I have tried using ArcGISDynamicMapServiceLayer, but it displays underneath the polygons. I've also tried turning on caching for the service, and the PNGs seem fine (the text shows), but I still get black boxes in my app. I've also tried embedding the fonts in the map service definition during the service publishing phase, but still no luck.

I'm using version 3.14 of the API, and would appreciate any advice. Thanks.

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Choon,

   If your parcels are added as a FeatureLayer then they are drawn by the client as a graphic client side and graphics/FeatureLayers are always on top of other layers like ArcGISDynamicMapserviceLayers. In order to display your Annotation layer you will have to add it as a ArcGISDynamicMapserviceLayer or else it will just be treated as a polygon as you are seeing. The only solution is to add your map service that has your parcels and your annotation layers as a ArcGISDynamicMapserviceLayer so that the anno can appear on top. if you must have your parcels as a feature layer so that you can have mouse events just set the symbology fill to none and for that layer and be sure to still add your parcels as a ArcGISDynamicMapserviceLayer as well. That way you will see the parcels and anno  but the feature layer will be on top just with no fill.

Choon_VuLam
Emerging Contributor

Robert,

Thanks! I'll try that out, but I have a reservation about this method : I also have a number of other layers between the parcels and annotation layer (zoning, etc), that also require mouse events, and I also have a LayerList dijit to control visibility of the layers. Using the 'invisible' layer method might lead to unwieldly code to 'sync' the visible and 'invisible' layers.

I'll probably be able to figure a nice way to do it, but do you have any thoughts on this?

Also, I thought a workable method would be to convert the annotation layer into a cached service. The tiles created are correct (the text is properly rendered), but somehow they just refuse to display properly. I can only guess that the FeatureLayer class isn't pulling the tiles (although it is for other layers).... Shouldn't the FeatureLayer class pull the tiles, if they're available? Esri's documentation doesn't seem to say anything about this..

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

FeatureLayers to not use tiles/cached. They draw directly on the client using the geometry for ArcGIS server. It would be difficult as you said to keep it all synced. The issue with your idea of caching is that a cached layer will still draw below the FeatureLayers.

Choon_VuLam
Emerging Contributor

Thanks. Looks like there isn't much choice, until Esri fixes it.

0 Kudos