Select to view content in your preferred language

LayerDrawingOptions Font Size Set Same As Server Default But Renders Smaller

4558
14
Jump to solution
01-09-2014 09:31 AM
Labels (1)
RyanCoodey
Frequent Contributor
I am building a dialog to allow the users to change a layers labeling scale, all other LayerDrawingOptions should stay at the defaults. Unfortnatly from what I can tell, there is no way to just change the label's min/max scale without also defining most the other LayerDrawingOptions. Found I could skip resetting the renderer (leave it null) if I also dont reset "Opacity".

First question, is there any easy way to just change the label min/max without having to specify all the other properties?

Since there is not a nice method like CreateDynamicLayerInfosFromLayerInfos() for LayerDrawingOptions I am retrieving all the layer info manually from the servers (JSON).

Second question, is there a built in way to get this info I am not seeing?

I am taking this info to build out a complete LayerDrawingOptions with the defaults from the server, but the Font Size (even though set to the same font settings as the server) gets smaller.

Third question, and most important, is this a bug? Why is it not rendering the same size?

Thanks a lot for any help or info!
0 Kudos
14 Replies
DominiqueBroux
Esri Frequent Contributor
I am able to display labels with your mpk file. See screenshot:

[ATTACH=CONFIG]32562[/ATTACH]

However, I have had to do 2 changes that could explain your issue:
    - filename is States1.mpk and not States.mpk
    - the map layer id is 0 and not 1  (MapLayerID="1" --> MapLayerID="0")
0 Kudos
SaranPon
Emerging Contributor
Hi,
Thank you for the quick findings...

Regarding your points

1) Yes, I did recreate the package with the name States1.mpk so no surprise here...
2) LayerID... this was the key...I tried with 0 earlier and 1, 2... I thought I didn't get any output if I use 0 however just now discovered that infact it takes longer to get the output... not sure why it takes longer to render... finally I got the output but in a way I need...

But at the same I couldn't see all the labels displayed for every state.... something weird happening... Is it related to environment?

I'm on Windows 2003 OS on a VM...

Note: I changed the field to [NAME2] so you are getting the abbr state names in the attached image...


[ATTACH=CONFIG]32565[/ATTACH]
0 Kudos
DominiqueBroux
Esri Frequent Contributor

But at the same I couldn't see all the labels displayed for every state.... something weird happening... Is it related to environment?

The labelling engine hides labels if there is not enough place to display them without overlap.
The labels should show up if you zoom in though.
0 Kudos
SaranPon
Emerging Contributor
Thanks. I see the reason now.... But why it is taking longer to draw the layer?... almost it took more than 2 minutes to render...

Regards,
Saran
0 Kudos
SaranPon
Emerging Contributor
OK... I just applied the MinScale value and see that it is performing better (it takes longer than EnableDynamicLayers=false option).. however at least now it is working... for the purpose of someone who is in need to fully working code, here it is.

Thank you Dominique.... Appreciate your help.

Regards,
Saran

<esri:Map>
            <esri:ArcGISLocalDynamicMapServiceLayer Path="States.mpk" >
                <esri:ArcGISLocalDynamicMapServiceLayer.LayerDrawingOptions>
                    <esri:LayerDrawingOptionsCollection>
                        <esri:LayerDrawingOptions LayerID="0" ShowLabels="True">
                            <esri:LayerDrawingOptions.LabelClasses>
                                <esri:LabelClassCollection>
                                    <!--<esri:LabelClass LabelExpression="[NAME1]" >
                                        <esri:LabelClass.LabelOptions>
                                            <esri:LabelOptions FontSize="10" Color="Red" />
                                        </esri:LabelClass.LabelOptions>
                                    </esri:LabelClass>-->
                                    <esri:LabelClass LabelExpression="[NAME1]" MinScale="15000000">
                                        <esri:LabelClass.LabelOptions>
                                            <esri:LabelOptions FontSize="15" Color="Green" />
                                        </esri:LabelClass.LabelOptions>
                                    </esri:LabelClass>
                               </esri:LabelClassCollection>
                            </esri:LayerDrawingOptions.LabelClasses>
                        </esri:LayerDrawingOptions>
                    </esri:LayerDrawingOptionsCollection>
                </esri:ArcGISLocalDynamicMapServiceLayer.LayerDrawingOptions>
                <esri:ArcGISLocalDynamicMapServiceLayer.DynamicLayerInfos>
                    <esri:DynamicLayerInfoCollection>
                        <esri:DynamicLayerInfo ID="0">
                            <esri:DynamicLayerInfo.Source>
                                <esri:LayerMapSource MapLayerID="0" />
                            </esri:DynamicLayerInfo.Source>
                        </esri:DynamicLayerInfo>
                    </esri:DynamicLayerInfoCollection>
                </esri:ArcGISLocalDynamicMapServiceLayer.DynamicLayerInfos>
            </esri:ArcGISLocalDynamicMapServiceLayer>
        </esri:Map>
0 Kudos