# Label Rendering Priority

**URL:** <https://community.thinkgeo.com/t/label-rendering-priority/5387>\
**Category:** WebForms\
**Created:** [July 7, 2010, 12:10pm UTC](https://community.thinkgeo.com/t/label-rendering-priority/5387 "2010-07-07T12:10:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gary1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/db5fbb/32.png) [@Gary1](https://community.thinkgeo.com/u/Gary1)\
**Post date:** [July 7, 2010, 12:10pm UTC](https://community.thinkgeo.com/t/label-rendering-priority/5387/1 "2010-07-07T12:10:28Z")

</div>

Hi,

We&nbsp;use&nbsp;the&nbsp;approach&nbsp;outlined&nbsp;in&nbsp;the&nbsp;"Label&nbsp;Nice&nbsp;Looking&nbsp;Roads"&nbsp;sample&nbsp;so&nbsp;that&nbsp;all&nbsp;of&nbsp;our&nbsp;shapes&nbsp;are&nbsp;rendered&nbsp;as&nbsp;multiple&nbsp;tiles,&nbsp;whilst&nbsp;all&nbsp;the&nbsp;labels&nbsp;are&nbsp;rendered&nbsp;as&nbsp;a&nbsp;single&nbsp;tile&nbsp;overlaid&nbsp;on&nbsp;top.&nbsp;Each&nbsp;road&nbsp;class&nbsp;and&nbsp;settlement&nbsp;class&nbsp;is&nbsp;in&nbsp;a&nbsp;separate&nbsp;layer,&nbsp;so&nbsp;we&nbsp;don't&nbsp;use&nbsp;values&nbsp;to&nbsp;determine&nbsp;appearance&nbsp;-&nbsp;everything&nbsp;is&nbsp;done&nbsp;using&nbsp;the&nbsp;default&nbsp;styles&nbsp;for&nbsp;the&nbsp;layer.

My&nbsp;question&nbsp;is&nbsp;whether&nbsp;there&nbsp;is&nbsp;a&nbsp;way&nbsp;to&nbsp;set&nbsp;the&nbsp;priority&nbsp;for&nbsp;label&nbsp;rendering,&nbsp;i.e.&nbsp;I&nbsp;would&nbsp;like&nbsp;the&nbsp;labels&nbsp;for&nbsp;larger&nbsp;settlements&nbsp;to&nbsp;be&nbsp;rendered&nbsp;over&nbsp;those&nbsp;for&nbsp;smaller&nbsp;settlements,&nbsp;so&nbsp;you&nbsp;would&nbsp;always&nbsp;see&nbsp;the&nbsp;name&nbsp;of&nbsp;a&nbsp;city&nbsp;but&nbsp;the&nbsp;names&nbsp;of&nbsp;any&nbsp;smaller&nbsp;towns&nbsp;nearby&nbsp;would&nbsp;only&nbsp;be&nbsp;rendered&nbsp;if&nbsp;there&nbsp;is&nbsp;enough&nbsp;space.&nbsp;At&nbsp;the&nbsp;moment&nbsp;I&nbsp;often&nbsp;see&nbsp;the&nbsp;names&nbsp;of&nbsp;smaller&nbsp;towns&nbsp;being&nbsp;rendered&nbsp;but&nbsp;not&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;city,&nbsp;even&nbsp;though&nbsp;the&nbsp;point&nbsp;representing&nbsp;the&nbsp;city&nbsp;is&nbsp;shown.

I've&nbsp;tried&nbsp;changing&nbsp;the&nbsp;order&nbsp;that&nbsp;layers&nbsp;are&nbsp;added&nbsp;into&nbsp;the&nbsp;overlay,&nbsp;but&nbsp;that&nbsp;doesn't&nbsp;seem&nbsp;to&nbsp;make&nbsp;any&nbsp;difference.&nbsp;Is&nbsp;it&nbsp;possible&nbsp;to&nbsp;prioritise&nbsp;the&nbsp;rendering&nbsp;of&nbsp;labels&nbsp;for&nbsp;certain&nbsp;layers&nbsp;in&nbsp;an&nbsp;overlay?

Best&nbsp;regards,

Gary

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![David](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@David](https://community.thinkgeo.com/u/David)\
**Post date:** [July 8, 2010, 12:19am UTC](https://community.thinkgeo.com/t/label-rendering-priority/5387/2 "2010-07-08T00:19:56Z")

</div>

Gary,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;The&nbsp;labels&nbsp;are&nbsp;rendered&nbsp;in&nbsp;the&nbsp;order&nbsp;of&nbsp;their&nbsp;drawing.&nbsp;&nbsp;So&nbsp;in&nbsp;this&nbsp;case&nbsp;we&nbsp;suggest&nbsp;that&nbsp;you&nbsp;draw&nbsp;the&nbsp;features&nbsp;separately&nbsp;from&nbsp;the&nbsp;label&nbsp;layers.&nbsp;&nbsp;The&nbsp;label&nbsp;layers&nbsp;that&nbsp;draw&nbsp;first&nbsp;have&nbsp;the&nbsp;priority&nbsp;over&nbsp;the&nbsp;ones&nbsp;that&nbsp;draw&nbsp;after&nbsp;them.&nbsp;&nbsp;The&nbsp;key&nbsp;is&nbsp;that&nbsp;in&nbsp;the&nbsp;Draw&nbsp;method&nbsp;we&nbsp;pass&nbsp;in&nbsp;labels&nbsp;that&nbsp;have&nbsp;already&nbsp;been&nbsp;drawn.&nbsp;&nbsp;If&nbsp;the&nbsp;large&nbsp;citied&nbsp;draw&nbsp;first&nbsp;there&nbsp;are&nbsp;no&nbsp;collisions.&nbsp;&nbsp;Then&nbsp;when&nbsp;the&nbsp;small&nbsp;cities&nbsp;draw&nbsp;next&nbsp;they&nbsp;may&nbsp;collide&nbsp;with&nbsp;large&nbsp;cities&nbsp;labels&nbsp;and&nbsp;they&nbsp;may&nbsp;be&nbsp;suppressed.&nbsp;&nbsp;So&nbsp;for&nbsp;labeling&nbsp;draw&nbsp;the&nbsp;most&nbsp;important&nbsp;label&nbsp;layers&nbsp;first.&nbsp;&nbsp;One&nbsp;other&nbsp;thing&nbsp;is&nbsp;that&nbsp;you&nbsp;may&nbsp;want&nbsp;to&nbsp;set&nbsp;the&nbsp;GridSize&nbsp;of&nbsp;the&nbsp;important&nbsp;layers&nbsp;to&nbsp;be&nbsp;smaller&nbsp;so&nbsp;more&nbsp;possible&nbsp;labels&nbsp;will&nbsp;label.&nbsp;&nbsp;The&nbsp;grid&nbsp;size&nbsp;tell&nbsp;the&nbsp;layer&nbsp;how&nbsp;many&nbsp;total&nbsp;labels&nbsp;you&nbsp;want&nbsp;on&nbsp;the&nbsp;screen,&nbsp;I&nbsp;mean&nbsp;one&nbsp;per&nbsp;grid.&nbsp;&nbsp;Try&nbsp;setting&nbsp;it&nbsp;to&nbsp;10&nbsp;or&nbsp;so.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Example:&nbsp;&nbsp;You&nbsp;have&nbsp;three&nbsp;files.&nbsp;&nbsp;Roads,&nbsp;Small&nbsp;Cities,&nbsp;Large&nbsp;Cities&nbsp;  
&nbsp;&nbsp;  
&nbsp;1.&nbsp;Render&nbsp;the&nbsp;features&nbsp;without&nbsp;labels&nbsp;first.&nbsp;&nbsp;In&nbsp;order&nbsp;like&nbsp;Roads,&nbsp;Small&nbsp;Cities,&nbsp;Large&nbsp;Cities&nbsp;  
&nbsp;&nbsp;  
&nbsp;2.&nbsp;Render&nbsp;the&nbsp;features&nbsp;as&nbsp;labels&nbsp;in&nbsp;this&nbsp;order:&nbsp;Large&nbsp;Cities,&nbsp;Small&nbsp;Cities,&nbsp;Roads.&nbsp;  
&nbsp;&nbsp;  
&nbsp;In&nbsp;this&nbsp;way&nbsp;you&nbsp;will&nbsp;actually&nbsp;have&nbsp;6&nbsp;layers.&nbsp;&nbsp;Three&nbsp;layers&nbsp;with&nbsp;area&nbsp;and&nbsp;line&nbsp;styles&nbsp;and&nbsp;three&nbsp;that&nbsp;have&nbsp;text&nbsp;styles.&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;hope&nbsp;this&nbsp;is&nbsp;clear,&nbsp;feel&nbsp;free&nbsp;to&nbsp;ask&nbsp;for&nbsp;clarification.&nbsp;&nbsp;We&nbsp;can&nbsp;also&nbsp;put&nbsp;together&nbsp;a&nbsp;sample&nbsp;for&nbsp;you.&nbsp;  
&nbsp;&nbsp;  
&nbsp;David

---

<div class="post-metadata">

**Author:** ![Gary1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/db5fbb/32.png) [@Gary1](https://community.thinkgeo.com/u/Gary1)\
**Post date:** [July 16, 2010, 5:03am UTC](https://community.thinkgeo.com/t/label-rendering-priority/5387/3 "2010-07-16T05:03:09Z")

</div>

Hi&nbsp;David,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;reply&nbsp;-&nbsp;I’ve&nbsp;been&nbsp;on&nbsp;vacation&nbsp;and&nbsp;have&nbsp;only&nbsp;just&nbsp;been&nbsp;able&nbsp;to&nbsp;pick&nbsp;this&nbsp;up&nbsp;again.&nbsp;  
&nbsp;&nbsp;  
&nbsp;You’re&nbsp;absolutely&nbsp;right&nbsp;-&nbsp;it&nbsp;does&nbsp;depend&nbsp;on&nbsp;the&nbsp;order&nbsp;of&nbsp;their&nbsp;drawing.&nbsp;I&nbsp;hadn’t&nbsp;seen&nbsp;this&nbsp;behaviour&nbsp;due&nbsp;to&nbsp;a&nbsp;configuration&nbsp;issue&nbsp;at&nbsp;my&nbsp;end.&nbsp;I’ve&nbsp;corrected&nbsp;that&nbsp;and&nbsp;it’s&nbsp;now&nbsp;working&nbsp;as&nbsp;expected.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Many&nbsp;thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Gary

---

<div class="post-metadata">

**Author:** ![David](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@David](https://community.thinkgeo.com/u/David)\
**Post date:** [July 16, 2010, 8:36am UTC](https://community.thinkgeo.com/t/label-rendering-priority/5387/4 "2010-07-16T08:36:48Z")

</div>

Gary,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;Glad&nbsp;you&nbsp;were&nbsp;able&nbsp;to&nbsp;get&nbsp;it&nbsp;working&nbsp;correctly.&nbsp;&nbsp;Just&nbsp;let&nbsp;us&nbsp;know&nbsp;if&nbsp;you&nbsp;have&nbsp;any&nbsp;more&nbsp;questions.&nbsp;  
&nbsp;&nbsp;  
&nbsp;David
