<?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 How to label Features in FeatureCollectionTable in Qt Maps SDK Questions</title>
    <link>https://community.esri.com/t5/qt-maps-sdk-questions/how-to-label-features-in-featurecollectiontable/m-p/636935#M3200</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to label features in&amp;nbsp;FeatureCollectionTable? I am using ArcGIS Runtime for Qt. Kindly share a sample code if possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Apr 2018 15:39:59 GMT</pubDate>
    <dc:creator>VishnuB</dc:creator>
    <dc:date>2018-04-16T15:39:59Z</dc:date>
    <item>
      <title>How to label Features in FeatureCollectionTable</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/how-to-label-features-in-featurecollectiontable/m-p/636935#M3200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to label features in&amp;nbsp;FeatureCollectionTable? I am using ArcGIS Runtime for Qt. Kindly share a sample code if possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2018 15:39:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/how-to-label-features-in-featurecollectiontable/m-p/636935#M3200</guid>
      <dc:creator>VishnuB</dc:creator>
      <dc:date>2018-04-16T15:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to label Features in FeatureCollectionTable</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/how-to-label-features-in-featurecollectiontable/m-p/636936#M3201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;OL&gt;&lt;LI&gt;add a field name to your FeatureCollectionTable, this is the field you want to label from, in my case I had a QString NAME_FIELD.&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;QList&amp;lt;Field&amp;gt; fieldNames;&lt;BR /&gt; fieldNames.push_back(Field::createText(NAME_FIELD, NAME_FIELD, NAME_LENGTH));&lt;BR /&gt; labelFeatureTable = new FeatureCollectionTable(fieldNames, GeometryType::Point, spatialReference, this);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/LI&gt;&lt;LI&gt;Create a renderer for the FeatureCollectionTable, my table is point based so the renderer has a simple marker symbol, which is hidden to the user&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;// empty point which is the anchor marker for the label&lt;BR /&gt; SimpleMarkerSymbol *simpleSym = new SimpleMarkerSymbol(this);&lt;BR /&gt; simpleSym-&amp;gt;setSize(0.0);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/LI&gt;&lt;LI&gt;Create a symbol for your text labels, this is what goes into the label definition&lt;BR /&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;TextSymbol* textSym = new TextSymbol("text", color, 12, HorizontalAlignment::Left, VerticalAlignment::Middle, this);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/LI&gt;&lt;LI&gt;Do the json magic to do label definitions&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;FeatureLayer *labelLayer = labelFeatureTable-&amp;gt;featureLayer();&lt;BR /&gt; if (labelLayer != NULL)&lt;BR /&gt; {&lt;BR /&gt; LabelDefinitionListModel* labelDefinitions =&lt;BR /&gt; labelLayer-&amp;gt;labelDefinitions();&lt;BR /&gt; if (labelDefinitions != NULL)&lt;BR /&gt; {&lt;BR /&gt; QJsonObject obj;&lt;/P&gt;&lt;P&gt;QJsonDocument textDoc = QJsonDocument::fromJson(&lt;BR /&gt; textSym-&amp;gt;toJson().toUtf8());&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;// &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fdevelopers.arcgis.com%2Fweb-map-specification%2Fobjects%2FlabelingInfo%2F" rel="nofollow" target="_blank"&gt;https://developers.arcgis.com/web-map-specification/objects/labelingInfo/&lt;/A&gt;&lt;BR /&gt; obj.insert(QString("symbol"), textDoc.object());&lt;/P&gt;&lt;P&gt;QString labelExpression = QString("$feature.") + NAME_FIELD;&lt;BR /&gt; QJsonObject labelExpressionObj;&lt;/P&gt;&lt;P&gt;labelExpressionObj.insert(QString("expression"), labelExpression);&lt;BR /&gt; obj.insert(QString("labelExpressionInfo"), labelExpressionObj);&lt;BR /&gt; obj.insert(QString("deconflictionStrategy"), QString("none"));&lt;BR /&gt; obj.insert(QString("labelPlacement"),&lt;BR /&gt; QString("esriServerPointLabelPlacementAboveRight"));&lt;BR /&gt; obj.insert(QString("maxScale"), 0);&lt;BR /&gt; obj.insert(QString("minScale"), 0);&lt;BR /&gt; obj.insert(QString("useCodedValues"), true);&lt;BR /&gt; QJsonDocument newDoc(obj);&lt;/P&gt;&lt;P&gt;Esri::ArcGISRuntime::LabelDefinition* newlabelDef =&lt;BR /&gt; Esri::ArcGISRuntime::LabelDefinition::fromJson(&lt;BR /&gt; newDoc.toJson(QJsonDocument::Indented));&lt;/P&gt;&lt;P&gt;if (newlabelDef != NULL)&lt;BR /&gt; {&lt;/P&gt;&lt;P&gt;labelLayer-&amp;gt;labelDefinitions()-&amp;gt;append(newlabelDef);&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; cout &amp;lt;&amp;lt; "newlabelDef == NULL" &amp;lt;&amp;lt; endl;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; cout &amp;lt;&amp;lt; "labelDefinitions == NULL" &amp;lt;&amp;lt; endl;&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; cout &amp;lt;&amp;lt; "labelLayer == NULL" &amp;lt;&amp;lt; endl;&lt;BR /&gt; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Apparently my indentation did not carry over but hopefully this helps.&amp;nbsp; I had some issues when I first started programming this so that is why I NULL check everything.&amp;nbsp; I used QJsonObject so I wouldnt need to be careful escaping quote characters in text based json.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2018 14:53:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/how-to-label-features-in-featurecollectiontable/m-p/636936#M3201</guid>
      <dc:creator>TroyFoster</dc:creator>
      <dc:date>2018-04-17T14:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to label Features in FeatureCollectionTable</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/how-to-label-features-in-featurecollectiontable/m-p/636937#M3202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;Labels got displayed, but in my case the labels will be always moving and when one label overlaps with other, only one label is displayed and rest of the overlapped labels will be hidden. Is it possible to change the position of the labels if it gets overlapped while moving?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2018 10:54:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/how-to-label-features-in-featurecollectiontable/m-p/636937#M3202</guid>
      <dc:creator>VishnuB</dc:creator>
      <dc:date>2018-04-19T10:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to label Features in FeatureCollectionTable</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/how-to-label-features-in-featurecollectiontable/m-p/636938#M3203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;deconflictionStrategy has a few different options, I recommend going into the documentation for the json magic &lt;SPAN&gt; &lt;/SPAN&gt;&lt;A class="" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fdevelopers.arcgis.com%2Fweb-map-specification%2Fobjects%2FlabelingInfo%2F" rel="nofollow" target="_blank"&gt;https://developers.arcgis.com/web-map-specification/objects/labelingInfo/&lt;/A&gt; and seeing what the different options are and experimenting with them.&amp;nbsp; I think there also is a priority argument where you can specify which labels should be preferably displayed over others.&amp;nbsp; For that you would want to set up another field in your table and then have multiple labelDefinitions using a where statement for each one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2018 12:34:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/how-to-label-features-in-featurecollectiontable/m-p/636938#M3203</guid>
      <dc:creator>TroyFoster</dc:creator>
      <dc:date>2018-04-24T12:34:40Z</dc:date>
    </item>
  </channel>
</rss>

