<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Polygon Label features dont show in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1201171#M11249</link>
    <description>&lt;P&gt;but wont it change the FontFamily(and all the other properties of the TextSymbol) to all&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;polygons/polylines/etc on the same layer?&lt;BR /&gt;&lt;BR /&gt;if i wasn't&amp;nbsp;clear, i want to control the TextSymbol individually per item in the layer&lt;BR /&gt;is that even possible?&lt;BR /&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Aug 2022 05:16:11 GMT</pubDate>
    <dc:creator>ofirrosner</dc:creator>
    <dc:date>2022-08-10T05:16:11Z</dc:date>
    <item>
      <title>Polygon Label features dont show</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1198043#M11197</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I'm using this &lt;A href="https://community.esri.com/t5/arcgis-runtime-sdks-blog/label-features-the-easy-way/ba-p/886207" target="_self"&gt;guide&lt;/A&gt;&lt;BR /&gt;with the example from&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;JsonLabelClass&lt;/STRONG&gt;.&amp;nbsp;&lt;BR /&gt;When i add a polygon and i want to add text to it with&amp;nbsp;&lt;EM&gt;PolygonAlwaysHorizontal no text is showing.&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;But when I'm&amp;nbsp;using any of the line options(e.g LineAboveBefore) it will show my text(not in the optimal way) but something i shown&lt;BR /&gt;&lt;BR /&gt;why the polygon one is not showing and how can i overcome it?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 15:48:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1198043#M11197</guid>
      <dc:creator>ofirrosner</dc:creator>
      <dc:date>2022-08-01T15:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon Label features dont show</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1199988#M11220</link>
      <description>&lt;P&gt;Hi, I'm sorry to hear the JSON label code isn't working for you.&amp;nbsp;The good news is, as of v100.11, ArcGIS Runtime provides a labeling API to wrap this functionality. If you're able to move to a more recent version, perhaps try using the API to add your labels. You'll find more details in the developer guide here:&amp;nbsp;&lt;A href="https://developers.arcgis.com/net/styles-and-data-visualization/add-labels/" target="_blank"&gt;https://developers.arcgis.com/net/styles-and-data-visualization/add-labels/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 18:30:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1199988#M11220</guid>
      <dc:creator>ThadTilton</dc:creator>
      <dc:date>2022-08-05T18:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon Label features dont show</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1200178#M11224</link>
      <description>&lt;P&gt;Thanks&lt;BR /&gt;im using 100.5.0 and sadly we cannot upgrade. but we found workaround&lt;BR /&gt;&lt;BR /&gt;on that, a follow up question&lt;BR /&gt;IS there a way to edit label color/font size/font family/etc on runtime.&lt;BR /&gt;The&amp;nbsp;&lt;EM&gt;LabelDefinition&amp;nbsp;&lt;/EM&gt;is defined per layer.&lt;BR /&gt;For example to change the font-familly:&lt;BR /&gt;&lt;BR /&gt;_layer.LabelDefinitions.Clear();&lt;BR /&gt;labelClass.Symbol.Font.Family = _fontfamily&lt;BR /&gt;&lt;BR /&gt;it works fine for 1 or maybe two polygons or screen but with more its starts to get glitchy/dosent work at all&lt;/P&gt;</description>
      <pubDate>Sun, 07 Aug 2022 04:39:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1200178#M11224</guid>
      <dc:creator>ofirrosner</dc:creator>
      <dc:date>2022-08-07T04:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon Label features dont show</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1201117#M11247</link>
      <description>&lt;P&gt;I think the way you were doing it should work well, simply changing the text symbol properties on the label class. I tested a little and found that code like this worked as expected to change the font family for my labels.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;_labelDefinition.TextSymbol.FontFamily = FontFamilyTextBox.Text.Trim();&lt;/LI-CODE&gt;&lt;P&gt;The "_labelDefinition" variable is one of the label definitions defined for a feature layer. I simply stored it as a member variable so I could refer to it later. I did find that some fonts didn't work (like Segoe UI Emoji, eg) and the labels would just fall back to something like Arial. I also noticed that some fonts would result in a larger label and change which features labels were displayed. One caveat, I was testing using the same JSON label class but with a newer version of runtime (100.14).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2022 22:36:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1201117#M11247</guid>
      <dc:creator>ThadTilton</dc:creator>
      <dc:date>2022-08-09T22:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon Label features dont show</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1201171#M11249</link>
      <description>&lt;P&gt;but wont it change the FontFamily(and all the other properties of the TextSymbol) to all&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;polygons/polylines/etc on the same layer?&lt;BR /&gt;&lt;BR /&gt;if i wasn't&amp;nbsp;clear, i want to control the TextSymbol individually per item in the layer&lt;BR /&gt;is that even possible?&lt;BR /&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 05:16:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1201171#M11249</guid>
      <dc:creator>ofirrosner</dc:creator>
      <dc:date>2022-08-10T05:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon Label features dont show</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1201670#M11250</link>
      <description>&lt;P&gt;It would change it for all labels in the label definition. When you create a label definition, you can use a where clause to restrict which features are included. That allows you to do things like label major cities with a different label than smaller ones, etc.&lt;/P&gt;&lt;P&gt;I don't think that was illustrated in the JSON class example, but it would look something like this (notice the addition of the 'WhereClause').&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Create a new LabelInfo object and set the relevant properties (including the text symbol).
LabelClassInfo labelInfo = new LabelClassInfo()
{
	LabelPosition = "static",
	ArcadeExpression = "return $feature['" + LabelFieldComboBox.SelectedItem + "'];",
	MinScale = 0,
	MaxScale = 0,
	Priority = 30,
	RemoveDuplicateLabels = "featureType",
	StackLabel = true,
	Symbol = textSymbol,
        WhereClause = $"POP2020 &amp;gt; 1000000"
};
// Get the raw JSON from the label info object.
labelJson = labelInfo.GetJson();

// Create a new label definition from the JSON string.
LabelDefinition labelDef = LabelDefinition.FromJson(labelJson);&lt;/LI-CODE&gt;&lt;P&gt;This will label all features with a POP2020 attribute value greater than one million using the symbol defined. If you change the font or other properties of the symbol, it will only change the labels in this definition. If you need to narrow this down to a single feature, you could use a where clause based on a unique ID and then control that one feature's label.&lt;/P&gt;&lt;P&gt;Your other option would be to add a graphic to display the label for the feature. You can create a point to define where the label should appear, apply the appropriate TextSymbol, and then add it to a GraphicsOverlay in the view (see doc here for more info: &lt;A href="https://developers.arcgis.com/net/maps-2d/add-graphics-to-a-map-view/#display-text" target="_blank"&gt;https://developers.arcgis.com/net/maps-2d/add-graphics-to-a-map-view/#display-text&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 23:25:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1201670#M11250</guid>
      <dc:creator>ThadTilton</dc:creator>
      <dc:date>2022-08-10T23:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon Label features dont show</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1202673#M11264</link>
      <description>&lt;P&gt;Thanks&lt;BR /&gt;But wont i need to create LabelClassInfo for each graphic i have on map?&lt;BR /&gt;i mean&lt;BR /&gt;if i do&amp;nbsp; WhereClause = $"Guid =&amp;nbsp; {Guid}"&lt;BR /&gt;so it means that only 1 graphic will we able to abide to this rule&lt;BR /&gt;what im currently doing&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;LabelClass lableClass = GetExtendedLabel(guid)
int random = random.next(10,50);
grahpic.Attributes["GUID"] = random;
labelClass.Symbil.Font.Size = random;
grahpicOverlay.LabelDefinitions.Add(labelClass.ToLabelDefinition)
&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;and&amp;nbsp;&lt;STRONG&gt;GetExtendedLabel&amp;nbsp;&lt;/STRONG&gt;is same as your example just i changed&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;WhereClause = $"POP2020 &amp;gt; 1000000"&lt;/LI-CODE&gt;&lt;P&gt;To&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;WhereClause = $"GUID = {GUID}"&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;which result in no labels shown&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 11:29:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1202673#M11264</guid>
      <dc:creator>ofirrosner</dc:creator>
      <dc:date>2022-08-15T11:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon Label features dont show</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1202882#M11265</link>
      <description>&lt;P&gt;If you have more than just a few graphics, it probably wouldn't make sense to have a different label class for each one. I guess it depends on what your use case is. If you're doing something like showing the selected geoelement with a special label, you can have a dedicated label class for a selected graphic's label and then dynamically set the where clause on the class to include just the one graphic.&lt;/P&gt;&lt;P&gt;But yes, you can also modify the label symbol at run time as well to change font, size, color, etc.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 15:17:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1202882#M11265</guid>
      <dc:creator>ThadTilton</dc:creator>
      <dc:date>2022-08-15T15:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon Label features dont show</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1203191#M11269</link>
      <description>&lt;P&gt;What i am trying to do ,is after i used the sketch editor to create some graphic on the screen, i want to add label for it and let the user update it properties(text, font color, font size, etc)&lt;BR /&gt;&lt;BR /&gt;this is the code i have atm&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public void AddOrUpdateLabel(Guid guid, string text)
{
    var graphic = GetGrahpic(guid)
    graphic.attributes[MapConstans.LabelKey] = text;
    graphic.attributes["GUID"] = guid;
    var labelClass = CreateAndGetExtendedLabel(guid)
    int nextInt = rand.next(10,100);//just for testing purpose
    labelClass.Symbol.Font.size = nextInt;
    AddLabelToMap(labelClass)
    
}

public LabelClass CreateAndGetExtendedLabel(Guid guid)
{
    return new Label()
    {
        LabelPlacement = LabelPlacement.Default,
        LabelExpression = $"[{MapConstans.LabelKey}]";
        Priority = 8,
        DeconfictionStrategy = DeconfictionStrategy .Static,
        RemoveDuplicates = RemoveDuplicatesStrategy.None,
        Symbol = new LabelSymbol()
        {
            Color = Color.White,
            HaloColor = Color.Black,
            HaloSize = 1,
            Font = new Font() {Family = "Arial", Size= 12, weight = 
                               Fontweight.Bold},
        },
        Where = $"GUID LIKE {guid}";
}


 public void AddLabelToMap(LabelClass labelClass)
//adds to labelDefention

&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;with the above code &lt;STRONG&gt;no label is shown&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;but if i remove the&amp;nbsp;&lt;STRONG&gt;Where = $"GUID LIKE {guid}";&amp;nbsp; the label is shown&amp;nbsp;&lt;/STRONG&gt;but for all graphics at the same layer&lt;BR /&gt;P.s&lt;BR /&gt;Lets say that, for now, i only create new graphics and not update them, need to add some mechanism if the LabelClass already exists&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 12:00:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1203191#M11269</guid>
      <dc:creator>ofirrosner</dc:creator>
      <dc:date>2022-08-16T12:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon Label features dont show</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1203914#M11272</link>
      <description>&lt;P&gt;I think you're just missing the quotes around the guid value:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;WhereClause = $"GUID LIKE '{guid}'"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code that worked for me:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private async void CreatePolyButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
    var poly = await MyMapView.SketchEditor.StartAsync(SketchCreationMode.Polygon, false);
    string guid = Guid.NewGuid().ToString();
    var attr = new Dictionary&amp;lt;string, object&amp;gt;
    {
        { "GUID", guid }
    };
    var graphic = new Graphic(poly, attr);
    _overlay.Graphics.Add(graphic);

    var labelDef = GetGraphicLabelDef(System.Drawing.Color.Firebrick, guid);
    _overlay.LabelDefinitions.Clear();
    _overlay.LabelsEnabled = true;
    _overlay.LabelDefinitions.Add(labelDef);
}

private LabelDefinition GetGraphicLabelDef(System.Drawing.Color color, string guid)
{
    // Create a text symbol for styling the label.
    TextSymbol textSymbol = new TextSymbol
    {
        Size = 12,
        FontFamily = "Arial",
        Color = color,
        HaloColor = Color.White,
        HaloWidth = 2,
    };

    // Create a label expression using an Arcade expression script.
    LabelExpression arcadeLabelExpression = new ArcadeLabelExpression("$feature.GUID");

    // Create a new LabelInfo object and set the relevant properties (including the text symbol).
    var labelInfo = new LabelClassInfo(GeometryType.Polygon)
    {
        LabelPosition = LabelPosition.Static,
        ArcadeExpression = arcadeLabelExpression.Expression,
        MinScale = 0,
        MaxScale = 0,
        LabelPlacement = LabelPlacement.PolygonAlwaysHorizontal,
        Priority = 30,
        RemoveDuplicateLabels = DuplicateLabels.FeatureType,
        StackLabel = true,
        Symbol = textSymbol,
        WhereClause = $"GUID LIKE '{guid}'"
    };

    // Get the raw JSON from the label info object.
    string labelJson = labelInfo.ToJson();

    // Create a new label definition from the JSON string.
    LabelDefinition labelDef = LabelDefinition.FromJson(labelJson);
    return labelDef;
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 17 Aug 2022 19:36:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1203914#M11272</guid>
      <dc:creator>ThadTilton</dc:creator>
      <dc:date>2022-08-17T19:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon Label features dont show</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1204130#M11273</link>
      <description>&lt;P&gt;Do i have to do those line every time i want to add label definition&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; _overlay.LabelDefinitions.Clear();
_overlay.LabelsEnabled = true;
_overlay.LabelDefinitions.Add(labelDef);&lt;/LI-CODE&gt;&lt;P&gt;mainly im talking about the &lt;STRONG&gt;Clear() .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When i was trying to fetch the current(via the unique guid) label&amp;nbsp;definition&amp;nbsp; and update its properties, &lt;STRONG&gt;no changes&lt;/STRONG&gt; happened on the map, but when i do clear() and add() its works just fine&lt;BR /&gt;&lt;BR /&gt;does it mean i have to keep track of all label&amp;nbsp;definition that are in a certain layer and when i update some property i would need to do clear() and addAll()(this will be my method when i have all previous label detentions) ?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 11:42:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1204130#M11273</guid>
      <dc:creator>ofirrosner</dc:creator>
      <dc:date>2022-08-18T11:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon Label features dont show</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1204143#M11274</link>
      <description>&lt;P&gt;Works like a charm!&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 12:23:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/polygon-label-features-dont-show/m-p/1204143#M11274</guid>
      <dc:creator>ofirrosner</dc:creator>
      <dc:date>2022-08-18T12:23:33Z</dc:date>
    </item>
  </channel>
</rss>

