How to Create Dashed Line Border in a Dynamic Layer

1530
3
Jump to solution
01-13-2014 02:24 PM
TomRippetoe
Occasional Contributor
Hello,

I am using the Silverlight 3.0 API and ArcGIS Server 10.1. I have a Dynamic Map Service Layer where i am trying to change polygon borders programmatically.  I want to the ability to set the border to be a dashed line. Can this be done using any of the standard Symbol types, e.g. SimpleFillSymbol, and properties?

I have seen this example (http://forums.arcgis.com/threads/59645-How-to-create-Dash-Dot-Dot-Border-for-custom-fill-symbol) and this one (http://forums.arcgis.com/threads/59645-How-to-create-Dash-Dot-Dot-Border-for-custom-fill-symbol) but they seem to apply specificly to client side graphics - not the symbology within a dynamic layer.

I can set a dashed boundary using 'Symbol.FromJson' fairly easily but its not particularly easy nor elegant. Additionally, i haven't been able to locate any specs about the JSON in terms of what values are possible. For example, how can i control the dash pattern, or space between the dashes?

Thank you,
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
No the standard SimpleFillSymbol doesn't support dashed lines.

The supported way to do it is to define your own serializable symbol.

The easiest but unsupported way is to use the internal ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleFillSymbol.

Something like:

....
     xmlns:symbols="clr-namespace:ESRI.ArcGIS.Client.FeatureService.Symbols;assembly=ESRI.ArcGIS.Client">

......

<esri:LayerDrawingOptions.Renderer>
    <esri:SimpleRenderer>
        <esri:SimpleRenderer.Symbol>
            <symbols:SimpleFillSymbol BorderBrush="#74E01B" BorderThickness="1" Fill="#7074E01B" BorderStyle="DashDotDot"  />
        </esri:SimpleRenderer.Symbol>
    </esri:SimpleRenderer>
</esri:LayerDrawingOptions.Renderer>

View solution in original post

0 Kudos
3 Replies
DominiqueBroux
Esri Frequent Contributor
No the standard SimpleFillSymbol doesn't support dashed lines.

The supported way to do it is to define your own serializable symbol.

The easiest but unsupported way is to use the internal ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleFillSymbol.

Something like:

....
     xmlns:symbols="clr-namespace:ESRI.ArcGIS.Client.FeatureService.Symbols;assembly=ESRI.ArcGIS.Client">

......

<esri:LayerDrawingOptions.Renderer>
    <esri:SimpleRenderer>
        <esri:SimpleRenderer.Symbol>
            <symbols:SimpleFillSymbol BorderBrush="#74E01B" BorderThickness="1" Fill="#7074E01B" BorderStyle="DashDotDot"  />
        </esri:SimpleRenderer.Symbol>
    </esri:SimpleRenderer>
</esri:LayerDrawingOptions.Renderer>
0 Kudos
TomRippetoe
Occasional Contributor
Thank you for the suggestion.  I will give that a try and let you know how it goes.

That's a nice little trick; why isn't it documented or 'supported'?
0 Kudos
TomRippetoe
Occasional Contributor
It works.  Thanks again.
0 Kudos