Solved! Go to Solution.
First question, is there any easy way to just change the label min/max without having to specify all the other properties?
<esri:Map> <esri:ArcGISDynamicMapServiceLayer Url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer"> <esri:ArcGISDynamicMapServiceLayer.LayerDrawingOptions> <esri:LayerDrawingOptionsCollection> <esri:LayerDrawingOptions LayerID="2" ShowLabels="True"> <esri:LayerDrawingOptions.LabelClasses> <esri:LabelClassCollection> <esri:LabelClass LabelExpression="[state_abbr]" MaxScale="15000000"> <esri:LabelClass.LabelOptions> <esri:LabelOptions FontSize="20" Color="Green" /> </esri:LabelClass.LabelOptions> </esri:LabelClass> <esri:LabelClass LabelExpression="[state_name] CONCAT NEWLINE CONCAT "Pop2000:" CONCAT [pop2000]" 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:ArcGISDynamicMapServiceLayer.LayerDrawingOptions> <esri:ArcGISDynamicMapServiceLayer.DynamicLayerInfos> <esri:DynamicLayerInfoCollection> <esri:DynamicLayerInfo ID="2"> <esri:DynamicLayerInfo.Source> <esri:LayerMapSource MapLayerID="2" /> </esri:DynamicLayerInfo.Source> </esri:DynamicLayerInfo> </esri:DynamicLayerInfoCollection> </esri:ArcGISDynamicMapServiceLayer.DynamicLayerInfos> </esri:ArcGISDynamicMapServiceLayer> </esri:Map>
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?
First question, is there any easy way to just change the label min/max without having to specify all the other properties?
<esri:Map> <esri:ArcGISDynamicMapServiceLayer Url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer"> <esri:ArcGISDynamicMapServiceLayer.LayerDrawingOptions> <esri:LayerDrawingOptionsCollection> <esri:LayerDrawingOptions LayerID="2" ShowLabels="True"> <esri:LayerDrawingOptions.LabelClasses> <esri:LabelClassCollection> <esri:LabelClass LabelExpression="[state_abbr]" MaxScale="15000000"> <esri:LabelClass.LabelOptions> <esri:LabelOptions FontSize="20" Color="Green" /> </esri:LabelClass.LabelOptions> </esri:LabelClass> <esri:LabelClass LabelExpression="[state_name] CONCAT NEWLINE CONCAT "Pop2000:" CONCAT [pop2000]" 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:ArcGISDynamicMapServiceLayer.LayerDrawingOptions> <esri:ArcGISDynamicMapServiceLayer.DynamicLayerInfos> <esri:DynamicLayerInfoCollection> <esri:DynamicLayerInfo ID="2"> <esri:DynamicLayerInfo.Source> <esri:LayerMapSource MapLayerID="2" /> </esri:DynamicLayerInfo.Source> </esri:DynamicLayerInfo> </esri:DynamicLayerInfoCollection> </esri:ArcGISDynamicMapServiceLayer.DynamicLayerInfos> </esri:ArcGISDynamicMapServiceLayer> </esri:Map>
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?
labelClass.LabelPlacement = (LabelPlacement)Enum.Parse(typeof(LabelPlacement), currentJSONLabelingInfo.labelPlacement.Replace("esriServer", "")); //Convert esriServerLinePlacementAboveAlong to LinePlacementAboveAlong
So 96 is the screen DPI (which I can have C# get the current users default in case this is not), but may I ask what the 72 is?
Now the labels almost match the same as the defaults, the only other thing that seems to be happening is the labels (in this case for a line) shift away from the line more than the defaults do. Setting the LabelClass.LabelPlacement like so:labelClass.LabelPlacement = (LabelPlacement)Enum.Parse(typeof(LabelPlacement), currentJSONLabelingInfo.labelPlacement.Replace("esriServer", "")); //Convert esriServerLinePlacementAboveAlong to LinePlacementAboveAlong
And there are no offsets or anything. Not a huge issue... but not sure why they are shifting a bit if you happen to know? Attached an image for clarification.
Thanks again for all the great help! If Dominique�??s boss is reading this, please give him a raise .
<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]" MaxScale="15000000"> <esri:LabelClass.LabelOptions> <esri:LabelOptions FontSize="20" Color="Green" /> </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>
<esri:ArcGISLocalDynamicMapServiceLayer Path="States.mpk" EnableDynamicLayers="True"> .....
<esri:LabelClass LabelExpression="[NAME1]" >
<esri:LabelClass LabelExpression=""TEST"" >
<esri:Map> <esri:ArcGISLocalDynamicMapServiceLayer Path="W:\Inforum Platform_Dev\Mapviewer\ESRIShapeFiles\Boundary\States.mpk" EnableDynamicLayers="True"> <esri:ArcGISLocalDynamicMapServiceLayer.LayerDrawingOptions> <esri:LayerDrawingOptionsCollection> <esri:LayerDrawingOptions LayerID="1" ShowLabels="True"> <esri:LayerDrawingOptions.LabelClasses> <esri:LabelClassCollection> <esri:LabelClass LabelExpression="[NAME1]" MaxScale="15000000"> <esri:LabelClass.LabelOptions> <esri:LabelOptions FontSize="20" Color="Green" /> </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="1"> <esri:DynamicLayerInfo.Source> <esri:LayerMapSource MapLayerID="1" /> </esri:DynamicLayerInfo.Source> </esri:DynamicLayerInfo> </esri:DynamicLayerInfoCollection> </esri:ArcGISLocalDynamicMapServiceLayer.DynamicLayerInfos> </esri:ArcGISLocalDynamicMapServiceLayer> </esri:Map>
Dominique,
I verified that I have a column named [NAME1] available... also tried to use the text as suggested.... nothing worked.