# Vehicle tracking application and best way to plot icons

**URL:** <https://community.thinkgeo.com/t/vehicle-tracking-application-and-best-way-to-plot-icons/604>\
**Category:** WinForms\
**Created:** [August 10, 2009, 7:59pm UTC](https://community.thinkgeo.com/t/vehicle-tracking-application-and-best-way-to-plot-icons/604 "2009-08-10T19:59:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ewan](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/e/dfb087/32.png) [@ewan](https://community.thinkgeo.com/u/ewan)\
**Post date:** [August 10, 2009, 7:59pm UTC](https://community.thinkgeo.com/t/vehicle-tracking-application-and-best-way-to-plot-icons/604/1 "2009-08-10T19:59:00Z")

</div>

I&nbsp;am&nbsp;spinning&nbsp;my&nbsp;wheels&nbsp;trying&nbsp;to&nbsp;upgrade&nbsp;from&nbsp;V2&nbsp;and&nbsp;looking&nbsp;for&nbsp;the&nbsp;best&nbsp;way&nbsp;to&nbsp;plot&nbsp;multiple&nbsp;icons&nbsp;(all&nbsp;with&nbsp;different&nbsp;images)&nbsp;and&nbsp;then&nbsp;to&nbsp;be&nbsp;able&nbsp;to&nbsp;move&nbsp;them&nbsp;around&nbsp;as&nbsp;the&nbsp;new&nbsp;positions&nbsp;come&nbsp;in.

&nbsp;

Any&nbsp;help&nbsp;available&nbsp;out&nbsp;there&nbsp;please

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [August 10, 2009, 11:56pm UTC](https://community.thinkgeo.com/t/vehicle-tracking-application-and-best-way-to-plot-icons/604/2 "2009-08-10T23:56:57Z")

</div>

Ewan,

Thanks&nbsp;for&nbsp;your&nbsp;post&nbsp;and&nbsp;questions!

Hope&nbsp;following&nbsp;&nbsp;project&nbsp;can&nbsp;satisfy&nbsp;with&nbsp;your&nbsp;requirement:  
  
[code.thinkgeo.com/projects/show/mapshapes](http://code.thinkgeo.com/projects/show/mapshapes)

Let&nbsp;me&nbsp;know&nbsp;if&nbsp;any&nbsp;more&nbsp;questions.  
  
Thanks.

Yale  
  
&nbsp;

---

<div class="post-metadata">

**Author:** ![ewan](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/e/dfb087/32.png) [@ewan](https://community.thinkgeo.com/u/ewan)\
**Post date:** [August 11, 2009, 8:09am UTC](https://community.thinkgeo.com/t/vehicle-tracking-application-and-best-way-to-plot-icons/604/3 "2009-08-11T08:09:51Z")

</div>

Is&nbsp;there&nbsp;supposed&nbsp;to&nbsp;be&nbsp;some&nbsp;sample&nbsp;code&nbsp;along&nbsp;with&nbsp;the&nbsp;article&nbsp;??

---

<div class="post-metadata">

**Author:** ![ewan](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/e/dfb087/32.png) [@ewan](https://community.thinkgeo.com/u/ewan)\
**Post date:** [August 11, 2009, 11:43am UTC](https://community.thinkgeo.com/t/vehicle-tracking-application-and-best-way-to-plot-icons/604/4 "2009-08-11T11:43:02Z")

</div>

OK&nbsp;I&nbsp;found&nbsp;the&nbsp;code&nbsp;-&nbsp;but&nbsp;does&nbsp;this&nbsp;work&nbsp;with&nbsp;Desktop&nbsp;??&nbsp;&nbsp;I&nbsp;cannot&nbsp;seem&nbsp;to&nbsp;find&nbsp;reference&nbsp;to&nbsp;MapShapeLayer&nbsp;or&nbsp;MapShape&nbsp;in&nbsp;the&nbsp;documentation&nbsp;for&nbsp;Desktop&nbsp;V3

---

<div class="post-metadata">

**Author:** ![ewan](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/e/dfb087/32.png) [@ewan](https://community.thinkgeo.com/u/ewan)\
**Post date:** [August 11, 2009, 3:03pm UTC](https://community.thinkgeo.com/t/vehicle-tracking-application-and-best-way-to-plot-icons/604/5 "2009-08-11T15:03:09Z")

</div>

OK&nbsp;I&nbsp;am&nbsp;making&nbsp;progress&nbsp;(&nbsp;I&nbsp;hope)&nbsp;but&nbsp;am&nbsp;stuck&nbsp;but&nbsp;am&nbsp;getting&nbsp;a&nbsp;null&nbsp;exception&nbsp;thrown&nbsp;from&nbsp;my&nbsp;iconLayer&nbsp;in&nbsp;the&nbsp;New\_Raster\_Position&nbsp;method&nbsp;??&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;hope&nbsp;you&nbsp;can&nbsp;help&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Ewan&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Private&nbsp;Sub&nbsp;Load\_Raster\_Map()&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gisMAP.AdornmentOverlay.ShowLogo&nbsp;=&nbsp;False&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gisMAP.ZoomLevelSnapping&nbsp;=&nbsp;ZoomLevelSnappingMode.None&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;Not&nbsp;My.Settings.lastMAPmap&nbsp;=&nbsp;Nothing&nbsp;Then&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;System.IO.File.Exists(My.Settings.lastMAPmap)&nbsp;=&nbsp;True&nbsp;Then&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gisMAP.Overlays.Clear()&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gisMAP.MapUnit&nbsp;=&nbsp;GeographyUnit.DecimalDegree&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;worldImageLayer&nbsp;As&nbsp;New&nbsp;GdiPlusRasterLayer(My.Settings.lastMAPmap)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;worldImageLayer.UpperThreshold&nbsp;=&nbsp;Double.MaxValue&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;worldImageLayer.LowerThreshold&nbsp;=&nbsp;0&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;staticOverlay&nbsp;As&nbsp;New&nbsp;LayerOverlay()&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;staticOverlay.Layers.Add(“WorldImageLayer”,&nbsp;worldImageLayer)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gisMAP.Overlays.Add(staticOverlay)&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;worldImageLayer.Open()&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gisMAP.CurrentExtent&nbsp;=&nbsp;GetFullExtent()&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gisMAP.Refresh()&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gMapLBL.Text&nbsp;=&nbsp;GetFileNameWithoutExtension(worldImageLayer.PathFilename)&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;’&nbsp;Setup&nbsp;the&nbsp;mapshape&nbsp;layer.&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;iconLayer&nbsp;As&nbsp;New&nbsp;MapShapeLayer&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iconLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType&nbsp;=&nbsp;ThinkGeo.MapSuite.Core.PointType.Bitmap&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iconLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle&nbsp;=&nbsp;LineStyles.ContestedBorder2&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iconLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel&nbsp;=&nbsp;ApplyUntilZoomLevel.Level20&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;iconOverlay&nbsp;As&nbsp;New&nbsp;LayerOverlay()&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iconOverlay.Layers.Add(“iconLayer”,&nbsp;iconLayer)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gisMAP.Overlays.Add(“iconOverlay”,&nbsp;iconOverlay)&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;If&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;If&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Select&nbsp;Case&nbsp;My.Settings.mapBalloon&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case&nbsp;Is&nbsp;=&nbsp;True&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ToolBarBalloon.ImageIndex&nbsp;=&nbsp;22&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case&nbsp;Is&nbsp;=&nbsp;False&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ToolBarBalloon.ImageIndex&nbsp;=&nbsp;21&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Select&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Sub&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Private&nbsp;Sub&nbsp;New\_Raster\_Position(ByVal&nbsp;Unit\_Name&nbsp;As&nbsp;String,&nbsp;ByVal&nbsp;Unit\_Operator&nbsp;As&nbsp;String,&nbsp;ByVal&nbsp;Lat&nbsp;As&nbsp;Double,&nbsp;ByVal&nbsp;Lon&nbsp;As&nbsp;Double,&nbsp;ByVal&nbsp;Speed&nbsp;As&nbsp;Double,&nbsp;ByVal&nbsp;Direction&nbsp;As&nbsp;Integer,&nbsp;ByVal&nbsp;Status&nbsp;As&nbsp;String)&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;IconPath&nbsp;As&nbsp;String&nbsp;=&nbsp;Get\_GIS\_Icon(Unit\_Name)&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;System.IO.File.Exists(IconPath)&nbsp;=&nbsp;False&nbsp;Then&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IconPath&nbsp;=&nbsp;AppPath&nbsp;&&nbsp;“\icons\gis\base.png”&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;If&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gisMAP.Overlays(“iconOverlay”).Lock.EnterWriteLock()&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Try&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;iconLayer&nbsp;As&nbsp;MapShapeLayer&nbsp;=&nbsp;DirectCast(gisMAP.FindFeatureLayer(“iconLayer”),&nbsp;MapShapeLayer)&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;myMapShape&nbsp;As&nbsp;New&nbsp;MapShape(New&nbsp;Feature(Lon,&nbsp;Lat,&nbsp;Unit\_Name))&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myMapShape.ZoomLevels.ZoomLevel01.DefaultPointStyle&nbsp;=&nbsp;New&nbsp;PointStyle(New&nbsp;GeoImage(IconPath))&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myMapShape.ZoomLevels.ZoomLevel01.ApplyUntilZoomLevel&nbsp;=&nbsp;ApplyUntilZoomLevel.Level20&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;Not&nbsp;iconLayer.MapShapes.ContainsKey(Unit\_Name)&nbsp;Then&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iconLayer.MapShapes.Add(Unit\_Name,&nbsp;myMapShape)&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iconLayer.Open()&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iconLayer.EditTools.BeginTransaction()&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iconLayer.EditTools.Delete(Unit\_Name)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iconLayer.EditTools.CommitTransaction()&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iconLayer.Close()&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iconLayer.MapShapes.Add(Unit\_Name,&nbsp;myMapShape)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;If&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Finally&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gisMAP.Overlays(“iconOverlay”).Lock.ExitWriteLock()&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Try&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gisMAP.Refresh()&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Sub&nbsp;  
&nbsp;&nbsp;  
&nbsp;Public&nbsp;Class&nbsp;MapShape&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Private&nbsp;m\_feature&nbsp;As&nbsp;Feature&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Private&nbsp;zoomLevelSet&nbsp;As&nbsp;ZoomLevelSet&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Public&nbsp;Sub&nbsp;New()&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Me.New(New&nbsp;Feature())&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Sub&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;’&nbsp;Let’s&nbsp;use&nbsp;this&nbsp;as&nbsp;a&nbsp;handy&nbsp;constructor&nbsp;if&nbsp;you&nbsp;already&nbsp;have&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;’&nbsp;a&nbsp;feature&nbsp;or&nbsp;want&nbsp;to&nbsp;create&nbsp;one&nbsp;inline.&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Public&nbsp;Sub&nbsp;New(ByVal&nbsp;feature&nbsp;As&nbsp;Feature)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Me.m\_feature&nbsp;=&nbsp;feature&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zoomLevelSet&nbsp;=&nbsp;New&nbsp;ZoomLevelSet()&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Sub&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;’&nbsp;&nbsp;This&nbsp;is&nbsp;the&nbsp;feature&nbsp;property,&nbsp;pretty&nbsp;simple.&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Public&nbsp;Property&nbsp;Feature()&nbsp;As&nbsp;Feature&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return&nbsp;m\_feature&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Get&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set(ByVal&nbsp;value&nbsp;As&nbsp;Feature)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m\_feature&nbsp;=&nbsp;value&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Set&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Property&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;’&nbsp;This&nbsp;is&nbsp;the&nbsp;Zoom&nbsp;Level&nbsp;Set.&nbsp;&nbsp;This&nbsp;high&nbsp;level&nbsp;object&nbsp;has&nbsp;all&nbsp;of&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;’&nbsp;the&nbsp;logic&nbsp;in&nbsp;it&nbsp;for&nbsp;zoom&nbsp;levels,&nbsp;drawing&nbsp;and&nbsp;everything.&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Public&nbsp;Property&nbsp;ZoomLevels()&nbsp;As&nbsp;ZoomLevelSet&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return&nbsp;zoomLevelSet&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Get&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set(ByVal&nbsp;value&nbsp;As&nbsp;ZoomLevelSet)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zoomLevelSet&nbsp;=&nbsp;value&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Set&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Property&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;End&nbsp;Class&nbsp;  
&nbsp;&nbsp;  
&nbsp;Class&nbsp;MapShapeLayer&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Inherits&nbsp;FeatureLayer&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Private&nbsp;m\_mapShapes&nbsp;As&nbsp;Dictionary(Of&nbsp;String,&nbsp;MapShape)&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Public&nbsp;Sub&nbsp;New()&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m\_mapShapes&nbsp;=&nbsp;New&nbsp;Dictionary(Of&nbsp;String,&nbsp;MapShape)()&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Sub&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;’&nbsp;Here&nbsp;is&nbsp;where&nbsp;you&nbsp;place&nbsp;all&nbsp;of&nbsp;your&nbsp;map&nbsp;shapes.&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Public&nbsp;ReadOnly&nbsp;Property&nbsp;MapShapes()&nbsp;As&nbsp;Dictionary(Of&nbsp;String,&nbsp;MapShape)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return&nbsp;m\_mapShapes&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Get&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Property&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;’&nbsp;This&nbsp;is&nbsp;a&nbsp;required&nbsp;overload&nbsp;of&nbsp;the&nbsp;Layer.&nbsp;&nbsp;As&nbsp;you&nbsp;can&nbsp;see&nbsp;we&nbsp;simply&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;’&nbsp;loop&nbsp;through&nbsp;all&nbsp;of&nbsp;our&nbsp;map&nbsp;shapes&nbsp;and&nbsp;then&nbsp;choose&nbsp;the&nbsp;correct&nbsp;zoom&nbsp;level.&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;’&nbsp;After&nbsp;that,&nbsp;the&nbsp;zoom&nbsp;level&nbsp;class&nbsp;takes&nbsp;care&nbsp;of&nbsp;the&nbsp;heavy&nbsp;lifiting.&nbsp;&nbsp;You&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;’&nbsp;have&nbsp;to&nbsp;love&nbsp;how&nbsp;easy&nbsp;this&nbsp;framework&nbsp;is&nbsp;to&nbsp;re-use.&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Protected&nbsp;Overloads&nbsp;Overrides&nbsp;Sub&nbsp;DrawCore(ByVal&nbsp;canvas&nbsp;As&nbsp;GeoCanvas,&nbsp;ByVal&nbsp;labelsInAllLayers&nbsp;As&nbsp;Collection(Of&nbsp;SimpleCandidate))&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For&nbsp;Each&nbsp;mapShapeKey&nbsp;As&nbsp;String&nbsp;In&nbsp;m\_mapShapes.Keys&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;mapShape&nbsp;As&nbsp;MapShape&nbsp;=&nbsp;m\_mapShapes(mapShapeKey)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim&nbsp;currentZoomLevel&nbsp;As&nbsp;ZoomLevel&nbsp;=&nbsp;mapShape.ZoomLevels.GetZoomLevelForDrawing(canvas.CurrentWorldExtent,&nbsp;canvas.Width,&nbsp;GeographyUnit.DecimalDegree)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;currentZoomLevel&nbsp;IsNot&nbsp;Nothing&nbsp;Then&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;canvas.CurrentWorldExtent.Intersects(mapShape.Feature.GetBoundingBox())&nbsp;Then&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currentZoomLevel.Draw(canvas,&nbsp;New&nbsp;Feature()&nbsp;{mapShape.Feature},&nbsp;New&nbsp;Collection(Of&nbsp;SimpleCandidate)(),&nbsp;labelsInAllLayers)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;If&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;If&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Next&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;Sub&nbsp;  
&nbsp;&nbsp;  
&nbsp;End&nbsp;Class&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [August 12, 2009, 1:26am UTC](https://community.thinkgeo.com/t/vehicle-tracking-application-and-best-way-to-plot-icons/604/6 "2009-08-12T01:26:34Z")

</div>

Ewan,

I&nbsp;am&nbsp;really&nbsp;willing&nbsp;to&nbsp;help&nbsp;you,&nbsp;but&nbsp;with&nbsp;your&nbsp;code,&nbsp;I&nbsp;am&nbsp;very&nbsp;confused&nbsp;what&nbsp;you&nbsp;are&nbsp;trying&nbsp;to&nbsp;do&nbsp;and&nbsp;it&nbsp;absolutely&nbsp;cannot&nbsp;be&nbsp;compiled&nbsp;because&nbsp;it&nbsp;lakes&nbsp;many&nbsp;methods.

&nbsp;  
I&nbsp;made&nbsp;a&nbsp;sample&nbsp;using&nbsp;MapShape&nbsp;from&nbsp;our&nbsp;code&nbsp;project,&nbsp;in&nbsp;this&nbsp;sample,&nbsp;you&nbsp;can&nbsp;add&nbsp;MapShape&nbsp;when&nbsp;you&nbsp;MapClick&nbsp;on&nbsp;the&nbsp;MapControl.  
&nbsp;  
Can&nbsp;you&nbsp;upload&nbsp;your&nbsp;sample&nbsp;project&nbsp;and&nbsp;paste&nbsp;out&nbsp;the&nbsp;exception&nbsp;stack&nbsp;trace&nbsp;to&nbsp;show&nbsp;your&nbsp;problem?  
&nbsp;  
Thanks.  
&nbsp;  
Yale  
  
[1033-MapShapesDemo.zip](https://community.thinkgeo.com/uploads/default/original/2X/f/fe61764b8275dc4a4d9a77d89fcdc1d1264d6c44.zip) (29.5 KB)
