# Display lat/long in label text for a GPS feature on map

**URL:** <https://community.thinkgeo.com/t/display-lat-long-in-label-text-for-a-gps-feature-on-map/673>\
**Category:** WinForms\
**Created:** [September 10, 2009, 10:57am UTC](https://community.thinkgeo.com/t/display-lat-long-in-label-text-for-a-gps-feature-on-map/673 "2009-09-10T10:57:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gregory](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/e56c9b/32.png) [@Gregory](https://community.thinkgeo.com/u/Gregory)\
**Post date:** [September 10, 2009, 10:57am UTC](https://community.thinkgeo.com/t/display-lat-long-in-label-text-for-a-gps-feature-on-map/673/1 "2009-09-10T10:57:37Z")

</div>

I&nbsp;am&nbsp;following&nbsp;the&nbsp;EfficientlyMoveAPlaneImage&nbsp;sample&nbsp;in&nbsp;the&nbsp;C#&nbsp;WPF&nbsp;VS&nbsp;2008&nbsp;project.&nbsp;However,&nbsp;instead&nbsp;of&nbsp;using&nbsp;the&nbsp;great&nbsp;circle&nbsp;arc&nbsp;I&nbsp;am&nbsp;using&nbsp;a&nbsp;GPS&nbsp;device's&nbsp;coordinates&nbsp;(with&nbsp;a&nbsp;simulator&nbsp;that&nbsp;moves&nbsp;the&nbsp;GPS&nbsp;device&nbsp;).&nbsp;A&nbsp;timer&nbsp;refreshes&nbsp;the&nbsp;map&nbsp;every&nbsp;second&nbsp;(just&nbsp;like&nbsp;the&nbsp;sample).

In&nbsp;order&nbsp;to&nbsp;display&nbsp;the&nbsp;latitude/longitude&nbsp;of&nbsp;the&nbsp;GPS&nbsp;device,&nbsp;I&nbsp;am&nbsp;using&nbsp;the&nbsp;following&nbsp;code:

\_featureLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle&nbsp;=

TextStyles.CreateSimpleTextStyle(LABEL\_KEY\_NAME,&nbsp;"Arial",&nbsp;10,&nbsp;DrawingFontStyles.Regular,&nbsp;GeoColor.StandardColors.White);

In&nbsp;addition,&nbsp;I&nbsp;have&nbsp;added&nbsp;an&nbsp;override&nbsp;to&nbsp;capture&nbsp;the&nbsp;CustomColumnFetch&nbsp;event.&nbsp;In&nbsp;the&nbsp;event&nbsp;I&nbsp;set&nbsp;the&nbsp;ColumnValue&nbsp;of&nbsp;the&nbsp;CustomColumnFetchEventArgs&nbsp;to&nbsp;the&nbsp;newly-updated&nbsp;latitude/longitude&nbsp;values&nbsp;of&nbsp;the&nbsp;GPS.

The&nbsp;problem&nbsp;is&nbsp;that&nbsp;when&nbsp;I&nbsp;refresh&nbsp;the&nbsp;map&nbsp;control&nbsp;(as&nbsp;in&nbsp;wpfMap1.Refresh)&nbsp;it&nbsp;doesn't&nbsp;force&nbsp;a&nbsp;refresh&nbsp;on&nbsp;the&nbsp;label&nbsp;text,&nbsp;and&nbsp;the&nbsp;event&nbsp;CustomColumnFetch&nbsp;does&nbsp;not&nbsp;re-fire.&nbsp;It&nbsp;only&nbsp;fires&nbsp;when&nbsp;I&nbsp;pan&nbsp;around&nbsp;the&nbsp;map.

Is&nbsp;this&nbsp;the&nbsp;right&nbsp;approach&nbsp;to&nbsp;handling&nbsp;this&nbsp;feature,&nbsp;and&nbsp;if&nbsp;so,&nbsp;how&nbsp;can&nbsp;I&nbsp;force&nbsp;a&nbsp;refresh&nbsp;on&nbsp;the&nbsp;label&nbsp;text?

Thanks!

Greg

&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:** [September 11, 2009, 2:21am UTC](https://community.thinkgeo.com/t/display-lat-long-in-label-text-for-a-gps-feature-on-map/673/2 "2009-09-11T02:21:34Z")

</div>

Greg,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;Two&nbsp;things&nbsp;on&nbsp;this.&nbsp;&nbsp;For&nbsp;the&nbsp;short&nbsp;run&nbsp;before&nbsp;Monday&nbsp;what&nbsp;you&nbsp;need&nbsp;to&nbsp;do&nbsp;is&nbsp;before&nbsp;you&nbsp;call&nbsp;your&nbsp;Refresh&nbsp;you&nbsp;need&nbsp;to&nbsp;call&nbsp;the&nbsp;Overlay.Lock.IsDirty&nbsp;=&nbsp;True.&nbsp;&nbsp;This&nbsp;is&nbsp;because&nbsp;we&nbsp;have&nbsp;an&nbsp;optimization&nbsp;that&nbsp;if&nbsp;you&nbsp;call&nbsp;refresh&nbsp;and&nbsp;you&nbsp;have&nbsp;not&nbsp;locked&nbsp;the&nbsp;overlay,&nbsp;set&nbsp;the&nbsp;IsDirty&nbsp;flag,&nbsp;or&nbsp;the&nbsp;current&nbsp;extent&nbsp;has&nbsp;not&nbsp;changed&nbsp;then&nbsp;we&nbsp;assume&nbsp;everything&nbsp;is&nbsp;the&nbsp;same&nbsp;and&nbsp;we&nbsp;just&nbsp;re-display&nbsp;a&nbsp;cached&nbsp;bitmap&nbsp;of&nbsp;the&nbsp;last&nbsp;screen&nbsp;draw.&nbsp;&nbsp;This&nbsp;is&nbsp;really&nbsp;effecient&nbsp;when&nbsp;drawing&nbsp;thousands&nbsp;on&nbsp;things&nbsp;on&nbsp;top&nbsp;of&nbsp;static&nbsp;maps.&nbsp;&nbsp;This&nbsp;is&nbsp;why&nbsp;panning&nbsp;causes&nbsp;it&nbsp;to&nbsp;fire&nbsp;and&nbsp;just&nbsp;a&nbsp;refresh&nbsp;standing&nbsp;still&nbsp;does&nbsp;not.&nbsp;&nbsp;In&nbsp;the&nbsp;version&nbsp;being&nbsp;release&nbsp;Monday&nbsp;we&nbsp;approach&nbsp;this&nbsp;a&nbsp;bit&nbsp;differently&nbsp;and&nbsp;when&nbsp;you&nbsp;call&nbsp;Refresh()&nbsp;we&nbsp;clear&nbsp;all&nbsp;caches.&nbsp;&nbsp;If&nbsp;only&nbsp;one&nbsp;overlay&nbsp;changed&nbsp;then&nbsp;the&nbsp;Refresh&nbsp;has&nbsp;a&nbsp;few&nbsp;new&nbsp;overloads&nbsp;where&nbsp;you&nbsp;can&nbsp;specify&nbsp;exactly&nbsp;the&nbsp;overlay&nbsp;or&nbsp;overlays&nbsp;that&nbsp;changed&nbsp;and&nbsp;we&nbsp;will&nbsp;only&nbsp;refresh&nbsp;those.&nbsp;&nbsp;I&nbsp;hope&nbsp;this&nbsp;helps&nbsp;out.&nbsp;&nbsp;Let&nbsp;me&nbsp;know&nbsp;what&nbsp;you&nbsp;find.&nbsp;&nbsp;The&nbsp;release&nbsp;should&nbsp;be&nbsp;Monday&nbsp;sometime&nbsp;but&nbsp;I&nbsp;am&nbsp;not&nbsp;sure&nbsp;if&nbsp;it&nbsp;will&nbsp;be&nbsp;the&nbsp;morning&nbsp;or&nbsp;afternoon.&nbsp;  
&nbsp;&nbsp;  
&nbsp;David&nbsp;
