Need python label expression to label linear assets in Arcmap 10.3 with length (rounded to nearest whole number) with a foot symbol(') at the end, plus a space, then text from a different field. Have this so far: round(float( [LLENGTH]), 0)
don't know about 10.3 or vb but in python and recent versions
leng <SPAN class="operator token">=</SPAN> <SPAN class="number token">7.4</SPAN> fld <SPAN class="operator token">=</SPAN> <SPAN class="string token">'from field'</SPAN> result <SPAN class="operator token">=</SPAN> <SPAN class="string token">"{}' {}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>round<SPAN class="punctuation token">(</SPAN>leng<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> fld<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>result<SPAN class="punctuation token">)</SPAN> <SPAN class="number token">7</SPAN>' <SPAN class="keyword token">from</SPAN> field<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Thanks, I may have tagged the question incorrectly, looking for label expression syntax for the Maplex Label Engine in Arcmap
Damon,
Dan has given the correct Python Label Expression in line 5 of his example. The first variable will be the LENGTH field, and the second is whatever other text field you chose.
You may have to convert the length field to a float first (line 3).
<SPAN class="string token">"{}' {}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>round<SPAN class="punctuation token">(</SPAN>leng<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> fld<SPAN class="punctuation token">)</SPAN> <SPAN class="string token">"{}' {}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>round<SPAN class="punctuation token">(</SPAN>float<SPAN class="punctuation token">(</SPAN>leng<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> fld<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Works great. Thanks!
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.