# Selecting points - scale issue

**URL:** <https://community.thinkgeo.com/t/selecting-points-scale-issue/1576>\
**Category:** WinForms\
**Created:** [January 31, 2011, 8:43am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576 "2011-01-31T08:43:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![David4](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/8e7dd6/32.png) [@David4](https://community.thinkgeo.com/u/David4)\
**Post date:** [January 31, 2011, 8:43am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/1 "2011-01-31T08:43:29Z")

</div>

I&nbsp;am&nbsp;trying&nbsp;to&nbsp;allow&nbsp;users&nbsp;to&nbsp;click&nbsp;on&nbsp;a&nbsp;ship&nbsp;using&nbsp;this&nbsp;code&nbsp;in&nbsp;the&nbsp;WinformsMap1\_MapClick()&nbsp;module:  
  
`Dim selectedFeatures As Collection(Of Feature) = shipLayer.QueryTools.GetFeaturesWithinDistanceOf(e.WorldLocation, GeographyUnit.DecimalDegree, DistanceUnit.Meter, 500, New String(0) {"NAME"})`  
  
It&nbsp;works&nbsp;fine.&nbsp;However,&nbsp;the&nbsp;500m&nbsp;boundary&nbsp;is&nbsp;too&nbsp;small&nbsp;at&nbsp;large&nbsp;scales&nbsp;&&nbsp;too&nbsp;big&nbsp;at&nbsp;small&nbsp;scales.&nbsp;Is&nbsp;there&nbsp;a&nbsp;way&nbsp;to&nbsp;select&nbsp;within&nbsp;say&nbsp;4&nbsp;or&nbsp;5&nbsp;pixels&nbsp;of&nbsp;a&nbsp;clicked&nbsp;point?  
  
And&nbsp;also,&nbsp;am&nbsp;I&nbsp;correct&nbsp;in&nbsp;saying&nbsp;that&nbsp;if&nbsp;I&nbsp;have&nbsp;my&nbsp;ships&nbsp;(points)&nbsp;as&nbsp;icons&nbsp;using&nbsp;this&nbsp;kind&nbsp;of&nbsp;code:  
  
`Dim rotatedImageStyle As New RotatedImageStyle(New GeoImage("GreenShipIcon.png"), "VCMG")`  
  
that&nbsp;there&nbsp;is&nbsp;no&nbsp;way&nbsp;of&nbsp;doing&nbsp;a&nbsp;selection&nbsp;where&nbsp;the&nbsp;user&nbsp;can&nbsp;click&nbsp;anywhere&nbsp;within&nbsp;the&nbsp;outline&nbsp;of&nbsp;the&nbsp;icon&nbsp;to&nbsp;select&nbsp;it,&nbsp;regardless&nbsp;of&nbsp;the&nbsp;size&nbsp;of&nbsp;the&nbsp;icon?

---

<div class="post-metadata">

**Author:** ![Val](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/v/e56c9b/32.png) [@Val](https://community.thinkgeo.com/u/Val)\
**Post date:** [January 31, 2011, 10:13am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/2 "2011-01-31T10:13:26Z")

</div>

David,

&nbsp;Actually&nbsp;we&nbsp;have&nbsp;a&nbsp;Code&nbsp;Community&nbsp;sample&nbsp;that&nbsp;addresses&nbsp;that&nbsp;issue&nbsp;of&nbsp;identifying&nbsp;features&nbsp;represented&nbsp;by&nbsp;icons&nbsp;by&nbsp;user&nbsp;click.&nbsp;I&nbsp;think&nbsp;you&nbsp;are&nbsp;going&nbsp;to&nbsp;find&nbsp;what&nbsp;you&nbsp;are&nbsp;looking&nbsp;for&nbsp;in&nbsp;this&nbsp;sample_&nbsp;Identify&nbsp;Point&nbsp;with&nbsp;Icon&nbsp;_[wiki.thinkgeo.com/wiki/Map\_Suite\_De...\_with\_Icon](http://wiki.thinkgeo.com/wiki/Map_Suite_Desktop_Edition_Spatial_Functions_Samples#Identify_Point_with_Icon)

If&nbsp;you&nbsp;still&nbsp;have&nbsp;doubts,&nbsp;let&nbsp;us&nbsp;know.&nbsp;Thank&nbsp;you.

&nbsp;

---

<div class="post-metadata">

**Author:** ![David4](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/8e7dd6/32.png) [@David4](https://community.thinkgeo.com/u/David4)\
**Post date:** [January 31, 2011, 8:42pm UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/3 "2011-01-31T20:42:14Z")

</div>

I&nbsp;don't&nbsp;quite&nbsp;have&nbsp;it&nbsp;working&nbsp;yet:&nbsp;  
  
--Usual&nbsp;problem&nbsp;trying&nbsp;to&nbsp;figure&nbsp;out&nbsp;a&nbsp;C#&nbsp;application&nbsp;when&nbsp;that&nbsp;is&nbsp;not&nbsp;my&nbsp;language.&nbsp;  
  
--Project&nbsp;mentioned&nbsp;has&nbsp;a&nbsp;Reference&nbsp;to&nbsp;WorldMapKitWms&nbsp;which&nbsp;isn't&nbsp;on&nbsp;my&nbsp;&nbsp;computer&nbsp;anywhere&nbsp;(but&nbsp;turns&nbsp;out&nbsp;to&nbsp;be&nbsp;a&nbsp;red&nbsp;herring&nbsp;as&nbsp;it&nbsp;doesn't&nbsp;&nbsp;appear&nbsp;to&nbsp;be&nbsp;needed)&nbsp;  
  
--crash&nbsp;in&nbsp;this&nbsp;line:&nbsp;  
  
`Dim  clickedFeatures As Collection(Of Feature) =  shipLayer2.QueryTools.GetFeaturesNearestTo(clickedPointShape,  GeographyUnit.DecimalDegree, 1, ReturningColumnsType.AllColumns)`&nbsp;  
  
"A&nbsp;.NET&nbsp;Framework&nbsp;error&nbsp;occurred&nbsp;during&nbsp;execution&nbsp;of&nbsp;user-defined&nbsp;routine&nbsp;or&nbsp;aggregate&nbsp;"geography":&nbsp;&nbsp;  
  
Microsoft.SqlServer.Types.GLArgumentException:&nbsp;24205:&nbsp;The&nbsp;specified&nbsp;&nbsp;input&nbsp;does&nbsp;not&nbsp;represent&nbsp;a&nbsp;valid&nbsp;geography&nbsp;instance&nbsp;because&nbsp;it&nbsp;exceeds&nbsp;a&nbsp;&nbsp;single&nbsp;hemisphere.&nbsp;Each&nbsp;geography&nbsp;instance&nbsp;must&nbsp;fit&nbsp;inside&nbsp;a&nbsp;single&nbsp;&nbsp;hemisphere.&nbsp;A&nbsp;common&nbsp;reason&nbsp;for&nbsp;this&nbsp;error&nbsp;is&nbsp;that&nbsp;a&nbsp;polygon&nbsp;has&nbsp;the&nbsp;&nbsp;wrong&nbsp;ring&nbsp;"&nbsp;

 ![](https://community.thinkgeo.com/uploads/default/original/2X/1/1216e9b7bdba54697315f2c97d3901e33aebed0b.png)

(clicking&nbsp;on&nbsp;any&nbsp;vessel&nbsp;icon&nbsp;in&nbsp;that&nbsp;map&nbsp;will&nbsp;cause&nbsp;that&nbsp;crash)

However,&nbsp;possible&nbsp;answers&nbsp;to&nbsp;my&nbsp;questions&nbsp;are:&nbsp;  
  
1)&nbsp;There&nbsp;doesn't&nbsp;appear&nbsp;to&nbsp;be&nbsp;a&nbsp;function&nbsp;to&nbsp;select&nbsp;within&nbsp;X&nbsp;pixels&nbsp;of&nbsp;a&nbsp;clicked&nbsp;point&nbsp;rather&nbsp;than&nbsp;a&nbsp;distance.&nbsp;  
  
2)&nbsp;It&nbsp;is&nbsp;possible&nbsp;to&nbsp;click&nbsp;on&nbsp;icons&nbsp;and&nbsp;detect&nbsp;this.&nbsp;However,&nbsp;&nbsp;  
  
a)&nbsp;If&nbsp;the&nbsp;icons&nbsp;do&nbsp;not&nbsp;take&nbsp;up&nbsp;the&nbsp;full&nbsp;rectangle&nbsp;and&nbsp;have&nbsp;transparent&nbsp;&nbsp;background,&nbsp;clicking&nbsp;in&nbsp;the&nbsp;rectangle&nbsp;but&nbsp;outside&nbsp;the&nbsp;icon&nbsp;border&nbsp;will&nbsp;&nbsp;still&nbsp;select&nbsp;that&nbsp;particular&nbsp;icon.&nbsp;  
  
b)&nbsp;If&nbsp;the&nbsp;icon&nbsp;is&nbsp;rotated,&nbsp;wrong&nbsp;&nbsp;selection&nbsp;may&nbsp;take&nbsp;place&nbsp;as&nbsp;the&nbsp;rotation&nbsp;of&nbsp;the&nbsp;rectangle&nbsp;isn't&nbsp;taken&nbsp;&nbsp;into&nbsp;account?&nbsp;I&nbsp;haven't&nbsp;been&nbsp;able&nbsp;to&nbsp;test&nbsp;this&nbsp;properly&nbsp;yet.

&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:** [February 1, 2011, 7:01am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/4 "2011-02-01T07:01:24Z")

</div>

David,

I&nbsp;think&nbsp;we&nbsp;have&nbsp;encountered&nbsp;this&nbsp;same&nbsp;issue&nbsp;before;&nbsp;I&nbsp;will&nbsp;make&nbsp;sure&nbsp;with&nbsp;our&nbsp;development&nbsp;team&nbsp;as&nbsp;soon&nbsp;as&nbsp;possible.  
&nbsp;  
Could&nbsp;you&nbsp;let&nbsp;me&nbsp;know&nbsp;that&nbsp;the&nbsp;type&nbsp;of&nbsp;the&nbsp;shipLayer2,&nbsp;is&nbsp;it&nbsp;line&nbsp;or&nbsp;polygon?&nbsp;Also,&nbsp;it&nbsp;would&nbsp;be&nbsp;kind&nbsp;enough&nbsp;if&nbsp;you&nbsp;could&nbsp;let&nbsp;me&nbsp;know&nbsp;the&nbsp;Desktop&nbsp;version&nbsp;information,&nbsp;you&nbsp;can&nbsp;get&nbsp;it&nbsp;by&nbsp;calling&nbsp;the&nbsp;following&nbsp;static&nbsp;API:  
`Dim version As String = WinformsMap.GetVersion()`  
&nbsp;  
Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.  
&nbsp;  
Thanks.  
&nbsp;  
Yale

---

<div class="post-metadata">

**Author:** ![David4](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/8e7dd6/32.png) [@David4](https://community.thinkgeo.com/u/David4)\
**Post date:** [February 1, 2011, 7:07am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/5 "2011-02-01T07:07:35Z")

</div>

ShipLayer2&nbsp;has&nbsp;only&nbsp;points&nbsp;in&nbsp;it.&nbsp;All&nbsp;WGS-84.&nbsp;There&nbsp;are&nbsp;points&nbsp;in&nbsp;the&nbsp;Northern&nbsp;&&nbsp;Southern&nbsp;(&&nbsp;Eastern&nbsp;&&nbsp;Western)&nbsp;Hemispheres.&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;MapSuiteCore:4.5.0.0&nbsp;  
&nbsp;DesktopEdition:4.5.0.0&nbsp;

---

<div class="post-metadata">

**Author:** ![Val](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/v/e56c9b/32.png) [@Val](https://community.thinkgeo.com/u/Val)\
**Post date:** [February 2, 2011, 10:53am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/6 "2011-02-02T10:53:56Z")

</div>

David,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;Can&nbsp;you&nbsp;give&nbsp;us&nbsp;the&nbsp;code&nbsp;you&nbsp;have&nbsp;for&nbsp;setting&nbsp;up&nbsp;that&nbsp;ShipLayer2&nbsp;layer&nbsp;with&nbsp;the&nbsp;styling&nbsp;etc?&nbsp;Also&nbsp;it&nbsp;would&nbsp;help&nbsp;to&nbsp;have&nbsp;that&nbsp;GreenShipIcon.png&nbsp;file.&nbsp;Basically&nbsp;you&nbsp;want&nbsp;to&nbsp;be&nbsp;able&nbsp;to&nbsp;click&nbsp;on&nbsp;the&nbsp;icon&nbsp;itself&nbsp;and&nbsp;identify&nbsp;the&nbsp;feature.&nbsp;I&nbsp;think&nbsp;that&nbsp;with&nbsp;the&nbsp;additional&nbsp;data&nbsp;we&nbsp;will&nbsp;get&nbsp;from&nbsp;you,&nbsp;we&nbsp;will&nbsp;be&nbsp;able&nbsp;to&nbsp;find&nbsp;a&nbsp;more&nbsp;concrete&nbsp;solution&nbsp;for&nbsp;your&nbsp;specific&nbsp;case.&nbsp;Thank&nbsp;you.

---

<div class="post-metadata">

**Author:** ![David4](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/8e7dd6/32.png) [@David4](https://community.thinkgeo.com/u/David4)\
**Post date:** [February 2, 2011, 7:01pm UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/7 "2011-02-02T19:01:29Z")

</div>

Layer&nbsp;creation:  
`Sub MakeShipLayer()        Logdebug(“MakeShipLayer(): Started”, “High”)        Dim FracDay As Single        ’ set up the Vessels layer here including showing labels        ShipLayer.Srid = 4326        ShipLayer.Name = “ShipLayer”        'Point Style with rotation - works, but equilateral triangles mean heading info not clear - change to a bitmap instead        'Dim rotatedpointStyle As New RotatedPointStyle(PointStyles.CreateSimpleTriangleStyle(GeoColor.SimpleColors.Red, 15, GeoColor.SimpleColors.Black), “VCMG”, 1)        Dim rotatedImageStyle As New RotatedImageStyle(New GeoImage(“GreenShipIcon.png”), “VCMG”)        ShipLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear()        'ShipLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(rotatedpointStyle) ’ no longer use point style, though might use it for trails later        ShipLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(rotatedImageStyle)        ’ this gives a custom style to the vessel labels        Dim textStyle As TextStyle = TextStyles.CreateSimpleTextStyle(“Name”, “Arial”, 10, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.FromArgb(100, GeoColor.SimpleColors.Yellow), 2, 0, -8)        ShipLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(textStyle)        textStyle.PointPlacement = PointPlacement.UpperRight        textStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping ’ make user definable later?        textStyle.BestPlacement = True        ShipLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20        TrailLayer.Srid = 4326        TrailLayer.Name = “TrailLayer”        ’ blue dot for trails. Later on change this to either arrow/dot matching colour of vessel OR red dot for stopped, green arrow (rotated) for moving        TrailLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen = New GeoPen(GeoColor.FromArgb(255, GeoColor.StandardColors.Blue), 1)        TrailLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20        ’ Set layer up for labels        Logdebug(“MakeShipLayer(): ShipLayer.ConnectionString=” & ShipLayer.ConnectionString, “High”)        Try            ShipLayer.Open()        Catch ea As SqlException            Logdebug(“MakeShipLayer(): Error=” & ea.Message, “High”)            grpSQLServer.BackColor = Color.Red            Debug.Print(ea.Message)            CanStart = False            Exit Sub        End Try        'Creates a VesselLyrOverlay for the InMemoryFeatureLayers (in this case only one InMemoryFeatureLayer)        Dim DynamicLayerOverlay As LayerOverlay = New LayerOverlay()        DynamicLayerOverlay.Name = “DynamicOverlay”        'Adds the InMemoryFeatureLayer with id “ShipLayer”.        DynamicLayerOverlay.Layers.Add(“ShipLayer”, ShipLayer)        DynamicLayerOverlay.Layers.Add(“TrailLayer”, TrailLayer)        'Adds the LayerOvelay to the Overlays collection of the map with id “VesselLyrOverlay”        WinformsMap1.Overlays.Add(“ShipLayerOverlay”, DynamicLayerOverlay)        Dim labelOverlay As New LayerOverlay()        labelOverlay.Name = “LabelOverlay”        labelOverlay.Layers.Add(“Label”, ShipLayer)        WinformsMap1.Overlays.Add(“LabelOverlay”, labelOverlay)        'ShipLayer.Close() ’ should I close this? I cannot Center on Vessel if I do this!    End Sub`&nbsp;  
  
Styling&nbsp;code:  
`Imports System.Collections.GenericImports System.Collections.ObjectModelImports System.LinqImports System.TextImports ThinkGeo.MapSuite.Core’Namespace RotatedImageStylePublic Class RotatedImageStyle    Inherits Style    Private m_geoImage As GeoImage    Private m_angleColumnName As String    Public Sub New()        Me.New(New GeoImage(), String.Empty)    End Sub    Public Sub New(ByVal geoImage As GeoImage, ByVal angleColumnName As String)        Me.m_geoImage = geoImage        Me.m_angleColumnName = angleColumnName    End Sub    Public Property GeoImage() As GeoImage        Get            Return m_geoImage        End Get        Set(ByVal value As GeoImage)            GeoImage = value        End Set    End Property    Public Property AngleColumnName() As String        Get            Return m_angleColumnName        End Get        Set(ByVal value As String)            AngleColumnName = value        End Set    End Property    Protected Overrides Sub DrawCore(ByVal features As IEnumerable(Of Feature), ByVal canvas As GeoCanvas, ByVal labelsInThisLayer As Collection(Of SimpleCandidate), ByVal labelsInAllLayers As Collection(Of SimpleCandidate))        For Each feature As Feature In features            'Dim angleData As Single = Convert.ToSingle(feature.ColumnValues(m_angleColumnName))            Dim angleData As Single = Convert.ToSingle(IIf(feature.ColumnValues(m_angleColumnName) <> “”, feature.ColumnValues(m_angleColumnName), 0))            Dim pointShape As PointShape = DirectCast(feature.GetShape(), PointShape)            'angleData);            canvas.DrawWorldImageWithoutScaling(m_geoImage, pointShape.X, pointShape.Y, DrawingLevel.LevelFour, 0, 0, _             360 - angleData)        Next    End Sub    Protected Overrides Function GetRequiredColumnNamesCore() As Collection(Of String)        Dim columns As New Collection(Of String)()        If Not columns.Contains(m_angleColumnName) Then            columns.Add(m_angleColumnName)        End If        Return columns    End FunctionEnd Class`&nbsp;  
  
Thanks,  
  
Dave

---

<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:** [February 5, 2011, 6:15am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/8 "2011-02-05T06:15:46Z")

</div>

David,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;post&nbsp;and&nbsp;questions.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Just&nbsp;let&nbsp;you&nbsp;know&nbsp;that&nbsp;I&nbsp;have&nbsp;sent&nbsp;this&nbsp;issue&nbsp;to&nbsp;our&nbsp;development&nbsp;team&nbsp;and&nbsp;I&nbsp;will&nbsp;try&nbsp;to&nbsp;focus&nbsp;on&nbsp;it&nbsp;as&nbsp;soon&nbsp;as&nbsp;the&nbsp;holiday&nbsp;is&nbsp;over&nbsp;on&nbsp;the&nbsp;middle&nbsp;of&nbsp;the&nbsp;next&nbsp;week,&nbsp;sorry&nbsp;for&nbsp;the&nbsp;inconvenience&nbsp;for&nbsp;now.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale&nbsp;

---

<div class="post-metadata">

**Author:** ![David4](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/8e7dd6/32.png) [@David4](https://community.thinkgeo.com/u/David4)\
**Post date:** [February 21, 2011, 6:56am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/9 "2011-02-21T06:56:19Z")

</div>

Hi&nbsp;Yale&nbsp;-&nbsp;any&nbsp;developments&nbsp;on&nbsp;this&nbsp;one?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Dave

---

<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:** [February 21, 2011, 8:45am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/10 "2011-02-21T08:45:55Z")

</div>

David,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;post&nbsp;and&nbsp;question&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;think&nbsp;this&nbsp;issue&nbsp;should&nbsp;have&nbsp;been&nbsp;fixed,&nbsp;while&nbsp;I&nbsp;have&nbsp;a&nbsp;few&nbsp;things&nbsp;to&nbsp;make&nbsp;sure.&nbsp;  
&nbsp;1)Is&nbsp;&nbsp;ShipLayer&nbsp;a&nbsp;MsSqlFeatureLayer&nbsp;or&nbsp;a&nbsp;ShapeFileFeatureLayer?&nbsp;I&nbsp;suppose&nbsp;it&nbsp;is&nbsp;a&nbsp;MsSqlFeatureaLayer.&nbsp;  
&nbsp;2)When&nbsp;querying&nbsp;against&nbsp;the&nbsp;ShipLayer,&nbsp;we&nbsp;will&nbsp;pass&nbsp;in&nbsp;a&nbsp;rectangle&nbsp;bounding&nbsp;box&nbsp;which&nbsp;will&nbsp;exceed&nbsp;two&nbsp;hemispheres,&nbsp;which&nbsp;will&nbsp;cause&nbsp;the&nbsp;problem,&nbsp;right?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale&nbsp;

---

<div class="post-metadata">

**Author:** ![David4](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/8e7dd6/32.png) [@David4](https://community.thinkgeo.com/u/David4)\
**Post date:** [February 21, 2011, 9:15am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/11 "2011-02-21T09:15:05Z")

</div>

1)&nbsp;It&nbsp;is&nbsp;a&nbsp;MsSqlFeatureLayer&nbsp;  
&nbsp;2)&nbsp;I&nbsp;believe&nbsp;the&nbsp;problem&nbsp;is&nbsp;that&nbsp;ThinkGeo&nbsp;passes&nbsp;a&nbsp;bounding&nbsp;box&nbsp;which&nbsp;exceeds&nbsp;2&nbsp;hemispheres&nbsp;(1&nbsp;hemisphere?)&nbsp;to&nbsp;SQL&nbsp;Server.&nbsp;This&nbsp;happens&nbsp;even&nbsp;when&nbsp;my&nbsp;points&nbsp;are&nbsp;in&nbsp;a&nbsp;limited&nbsp;locale&nbsp;-&nbsp;within&nbsp;a&nbsp;5°&nbsp;area&nbsp;around&nbsp;Malaysia.&nbsp;  
&nbsp;&nbsp;  
&nbsp;In&nbsp;fact&nbsp;there&nbsp;are&nbsp;a&nbsp;number&nbsp;of&nbsp;tasks&nbsp;that&nbsp;ThinkGeo&nbsp;does&nbsp;that&nbsp;cause&nbsp;that&nbsp;same&nbsp;error&nbsp;or&nbsp;sometimes&nbsp;this&nbsp;error:&nbsp;  
&nbsp;“A&nbsp;.NET&nbsp;Framework&nbsp;error&nbsp;occurred&nbsp;during&nbsp;execution&nbsp;of&nbsp;user-defined&nbsp;routine&nbsp;or&nbsp;aggregate&nbsp;“geography”:&nbsp;&nbsp;  
&nbsp;System.FormatException:&nbsp;24201:&nbsp;Latitude&nbsp;values&nbsp;must&nbsp;be&nbsp;between&nbsp;-90&nbsp;and&nbsp;90&nbsp;degrees.”&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;am&nbsp;not&nbsp;sure&nbsp;why&nbsp;it&nbsp;does&nbsp;that&nbsp;as&nbsp;none&nbsp;of&nbsp;my&nbsp;items&nbsp;are&nbsp;‘off&nbsp;the&nbsp;edge&nbsp;of&nbsp;the&nbsp;world’&nbsp;and&nbsp;all&nbsp;are&nbsp;points&nbsp;so&nbsp;there&nbsp;shouldn’t&nbsp;be&nbsp;a&nbsp;way&nbsp;a&nbsp;point&nbsp;could&nbsp;be&nbsp;in&nbsp;2&nbsp;hemispheres&nbsp;at&nbsp;once&nbsp;-&nbsp;unless&nbsp;by&nbsp;‘geography&nbsp;instance’&nbsp;it&nbsp;is&nbsp;talking&nbsp;about&nbsp;the&nbsp;bounding&nbsp;box…

---

<div class="post-metadata">

**Author:** ![Johnny](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/johnny/32/19044_2.png) [@Johnny](https://community.thinkgeo.com/u/Johnny)\
**Post date:** [February 21, 2011, 8:04pm UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/12 "2011-02-21T20:04:19Z")

</div>

Hi&nbsp;David,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;providing&nbsp;the&nbsp;further&nbsp;information,&nbsp;I&nbsp;think&nbsp;it&nbsp;should&nbsp;be&nbsp;caused&nbsp;by&nbsp;the&nbsp;error&nbsp;Ring&nbsp;orientation&nbsp;of&nbsp;the&nbsp;Polygon&nbsp;or&nbsp;the&nbsp;Linestring&nbsp;which&nbsp;excesses&nbsp;1&nbsp;hemisphere,&nbsp;can&nbsp;you&nbsp;give&nbsp;us&nbsp;several&nbsp;demo&nbsp;Sql&nbsp;statement&nbsp;using&nbsp;“ExecutingSqlStatement”&nbsp;event?&nbsp;Or&nbsp;is&nbsp;it&nbsp;possible&nbsp;to&nbsp;give&nbsp;us&nbsp;a&nbsp;demo&nbsp;data&nbsp;for&nbsp;test?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Johnny&nbsp;

---

<div class="post-metadata">

**Author:** ![David4](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/8e7dd6/32.png) [@David4](https://community.thinkgeo.com/u/David4)\
**Post date:** [February 21, 2011, 8:35pm UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/13 "2011-02-21T20:35:31Z")

</div>

There&nbsp;are&nbsp;no&nbsp;polygons&nbsp;or&nbsp;lines&nbsp;in&nbsp;my&nbsp;data&nbsp;set.&nbsp;I&nbsp;can&nbsp;possibly&nbsp;give&nbsp;you&nbsp;a&nbsp;data&nbsp;set&nbsp;though&nbsp;it&nbsp;will&nbsp;be&nbsp;pretty&nbsp;big&nbsp;-&nbsp;I&nbsp;presume&nbsp;you&nbsp;would&nbsp;need&nbsp;an&nbsp;MDF&nbsp;file?&nbsp;And&nbsp;the&nbsp;associated&nbsp;LDF&nbsp;log&nbsp;file?&nbsp;  
  
  
  
Maybe&nbsp;this&nbsp;ExecutingSqlStatement&nbsp;is&nbsp;the&nbsp;way&nbsp;to&nbsp;go&nbsp;-&nbsp;what&nbsp;is&nbsp;it&nbsp;an&nbsp;event&nbsp;for?&nbsp;Can't&nbsp;see&nbsp;any&nbsp;samples&nbsp;anywhere&nbsp;on&nbsp;your&nbsp;site....&nbsp;Do&nbsp;you&nbsp;have&nbsp;a&nbsp;line&nbsp;or&nbsp;2&nbsp;of&nbsp;code&nbsp;to&nbsp;help&nbsp;me&nbsp;get&nbsp;the&nbsp;info&nbsp;to&nbsp;you&nbsp;faster&nbsp;than&nbsp;me&nbsp;wading&nbsp;through&nbsp;the&nbsp;API?&nbsp;I&nbsp;do&nbsp;see&nbsp;1&nbsp;example&nbsp;here:

gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/11/aft/7192/afv/topic/Default.aspx

but&nbsp;am&nbsp;not&nbsp;sure&nbsp;whether&nbsp;that&nbsp;relates&nbsp;to&nbsp;my&nbsp;problem.&nbsp;In&nbsp;my&nbsp;case&nbsp;the&nbsp;crash&nbsp;can&nbsp;even&nbsp;occur&nbsp;trying&nbsp;to&nbsp;execute&nbsp;a&nbsp;ThinkGeo&nbsp;command:

WinformsMap1.Refresh()

Any&nbsp;chance&nbsp;that&nbsp;the&nbsp;code&nbsp;in&nbsp;that&nbsp;link&nbsp;is&nbsp;what&nbsp;I&nbsp;am&nbsp;after?&nbsp;If&nbsp;so,&nbsp;where&nbsp;would&nbsp;I&nbsp;put&nbsp;it,&nbsp;based&nbsp;on&nbsp;the&nbsp;line&nbsp;that&nbsp;is&nbsp;crashing&nbsp;in&nbsp;the&nbsp;original&nbsp;Winforms1\_Mousedown&nbsp;routine?

Thanks,&nbsp;  
  
  
  
Dave

---

<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:** [February 22, 2011, 6:17am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/14 "2011-02-22T06:17:24Z")

</div>

David,

I&nbsp;think&nbsp;it&nbsp;is&nbsp;better&nbsp;we&nbsp;could&nbsp;get&nbsp;the&nbsp;problem&nbsp;recreated&nbsp;using&nbsp;the&nbsp;event&nbsp;ExecutingSqlStatement,&nbsp;the&nbsp;event&nbsp;will&nbsp;pass&nbsp;out&nbsp;every&nbsp;sql&nbsp;statement&nbsp;sent&nbsp;to&nbsp;the&nbsp;SQL&nbsp;server,&nbsp;so&nbsp;if&nbsp;possible,&nbsp;try&nbsp;following&nbsp;code&nbsp;snippet,&nbsp;hope&nbsp;it&nbsp;helps:  
&nbsp;  
`MsSql2008FeatureLayer msSql2008FeatureLayer = new MsSql2008FeatureLayer("","","");            ((MsSql2008FeatureSource)(msSql2008FeatureLayer.FeatureSource)).ExecutingSqlStatement += new EventHandler<ExecutingSqlStatementMsSql2008FeatureSourceEventArgs>(DisplayShapeMap_ExecutingSqlStatement); void DisplayShapeMap_ExecutingSqlStatement(object sender, ExecutingSqlStatementMsSql2008FeatureSourceEventArgs e){    System.Diagnostics.Debug.WriteLine(e.SqlStatement);}`  
&nbsp;  
Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.  
&nbsp;  
Thanks.  
&nbsp;  
Yale

---

<div class="post-metadata">

**Author:** ![David4](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/8e7dd6/32.png) [@David4](https://community.thinkgeo.com/u/David4)\
**Post date:** [February 22, 2011, 8:46am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/15 "2011-02-22T08:46:31Z")

</div>

I&nbsp;agree&nbsp;that&nbsp;would&nbsp;be&nbsp;the&nbsp;most&nbsp;helpful&nbsp;way&nbsp;to&nbsp;see&nbsp;what&nbsp;is&nbsp;happening.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;chance&nbsp;you&nbsp;can&nbsp;provide&nbsp;that&nbsp;snippet&nbsp;in&nbsp;VB?&nbsp;Using&nbsp;[developerfusion.com/tools/convert/csharp-to-vb/](http://developerfusion.com/tools/convert/csharp-to-vb/)&nbsp;to&nbsp;translate&nbsp;results&nbsp;in:&nbsp;  
&nbsp;–&nbsp;line&nbsp;1&nbsp;col&nbsp;1:&nbsp;EOF&nbsp;expected

---

<div class="post-metadata">

**Author:** ![Val](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/v/e56c9b/32.png) [@Val](https://community.thinkgeo.com/u/Val)\
**Post date:** [February 22, 2011, 1:24pm UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/16 "2011-02-22T13:24:02Z")

</div>

David,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;Sorry&nbsp;for&nbsp;the&nbsp;C#&nbsp;sample&nbsp;code&nbsp;not&nbsp;being&nbsp;sufficiently&nbsp;broad.&nbsp;Yang&nbsp;will&nbsp;respond&nbsp;to&nbsp;you&nbsp;with&nbsp;the&nbsp;more&nbsp;complete&nbsp;code&nbsp;in&nbsp;both&nbsp;C#&nbsp;and&nbsp;VB.&nbsp;Thank&nbsp;you.

---

<div class="post-metadata">

**Author:** ![David4](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/8e7dd6/32.png) [@David4](https://community.thinkgeo.com/u/David4)\
**Post date:** [February 22, 2011, 6:50pm UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/17 "2011-02-22T18:50:36Z")

</div>

Thanks&nbsp;-&nbsp;looking&nbsp;forward&nbsp;to&nbsp;the&nbsp;VB&nbsp;version&nbsp;that&nbsp;will&nbsp;somehow&nbsp;incorporate&nbsp;with&nbsp;the&nbsp;crash&nbsp;in&nbsp;the&nbsp;MouseDown&nbsp;event.&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Not&nbsp;to&nbsp;say&nbsp;that&nbsp;the&nbsp;C#&nbsp;version&nbsp;won’t&nbsp;work,&nbsp;but&nbsp;if&nbsp;it&nbsp;won’t&nbsp;translate&nbsp;in&nbsp;[developerfusion.com/tools/convert/csharp-to-vb/](http://developerfusion.com/tools/convert/csharp-to-vb/)&nbsp;then&nbsp;it’s&nbsp;beyond&nbsp;my&nbsp;ability&nbsp;to&nbsp;figure&nbsp;out&nbsp;what&nbsp;went&nbsp;wrong,&nbsp;not&nbsp;being&nbsp;conversant&nbsp;in&nbsp;C#.

---

<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:** [February 23, 2011, 7:08am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/18 "2011-02-23T07:08:37Z")

</div>

David,

Thanks&nbsp;for&nbsp;your&nbsp;post&nbsp;and&nbsp;questions.&nbsp;Following&nbsp;code&nbsp;snippet&nbsp;is&nbsp;the&nbsp;VB&nbsp;version,&nbsp;hope&nbsp;it&nbsp;helps.  
&nbsp;  
`Dim msSql2008FeatureLayer As New MsSql2008FeatureLayer("", "", "")AddHandler DirectCast(msSql2008FeatureLayer.FeatureSource, MsSql2008FeatureSource).ExecutingSqlStatement, AddressOf DisplayShapeMap_ExecutingSqlStatement Private Sub DisplayShapeMap_ExecutingSqlStatement(ByVal sender As Object, ByVal e As ExecutingSqlStatementMsSql2008FeatureSourceEventArgs)      System.Diagnostics.Debug.WriteLine(e.SqlStatement)End Sub`  
&nbsp;  
Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.  
&nbsp;  
Thanks.  
&nbsp;  
Yale

---

<div class="post-metadata">

**Author:** ![David4](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/8e7dd6/32.png) [@David4](https://community.thinkgeo.com/u/David4)\
**Post date:** [February 23, 2011, 7:42am UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/19 "2011-02-23T07:42:14Z")

</div>

Ok,&nbsp;that&nbsp;is&nbsp;very&nbsp;helpful&nbsp;-&nbsp;we&nbsp;should&nbsp;be&nbsp;able&nbsp;to&nbsp;see&nbsp;what&nbsp;SQL&nbsp;Server&nbsp;doesn't&nbsp;like&nbsp;about&nbsp;the&nbsp;SQL&nbsp;statement.

To&nbsp;summarise,&nbsp;here&nbsp;is&nbsp;my&nbsp;code:

`Private Sub WinformsMap1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles WinformsMap1.MouseDown        ' I want to be able to click on a vessel or maybe a target or other object to interrogate it, etc. How do I do that?        Debug.Print("WinformsMap1_MouseDown(): Triggered. Button clicked was " & e.Button.ToString)        If Not Compiled() Then            'Stop        End If        'Exit Sub        'Gets the closest feature from where the user clicked on.        Dim shipLayer2 As MsSql2008FeatureLayer = WinformsMap1.FindFeatureLayer("ShipLayer") ' DirectCast(MapEngine.StaticLayers("PointLayer"), ShapeFileFeatureLayer)        shipLayer2.Open()        Dim clickedPointShape As PointShape = ExtentHelper.ToWorldCoordinate(mapEngine.CurrentExtent, e.X, e.Y, WinformsMap1.Width, WinformsMap1.Height)        Dim clickedFeatures As Collection(Of Feature) = shipLayer2.QueryTools.GetFeaturesNearestTo(clickedPointShape, GeographyUnit.DecimalDegree, 1, ReturningColumnsType.AllColumns)        shipLayer2.Close()`&nbsp;

When&nbsp;I&nbsp;left-click&nbsp;on&nbsp;a&nbsp;ship&nbsp;in&nbsp;ShipLayer,&nbsp;I&nbsp;get&nbsp;a&nbsp;crash&nbsp;in&nbsp;the&nbsp;2nd&nbsp;last&nbsp;&nbsp;line&nbsp;(Dim&nbsp;clickedFeatures.....):

A&nbsp;first&nbsp;chance&nbsp;exception&nbsp;of&nbsp;type&nbsp;'System.Data.SqlClient.SqlException'&nbsp;occurred&nbsp;in&nbsp;MapSuiteCore.dll  
  
System.Transactions&nbsp;Critical:&nbsp;0&nbsp;:  
\<tracerecord&nbsp;severity="Critical"\>  
\<traceidentifier\>  
msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled  
\</traceidentifier\>  
\<description\>Unhandled&nbsp;exception\</description\>\<appdomain\>MVMControl3.vshost.exe\</appdomain\>\<exception\>\<exceptiontype\>System.Data.SqlClient.SqlException,&nbsp;System.Data,&nbsp;Version=2.0.0.0,&nbsp;Culture=neutral,&nbsp;PublicKeyToken=b77a5c561934e089\</exceptiontype\>\<message\>A&nbsp;.NET&nbsp;Framework&nbsp;error&nbsp;occurred&nbsp;during&nbsp;execution&nbsp;of&nbsp;user-defined&nbsp;routine&nbsp;or&nbsp;aggregate&nbsp;"geography":&nbsp;  
  
Microsoft.SqlServer.Types.GLArgumentException:&nbsp;24205:&nbsp;The&nbsp;specified&nbsp;input&nbsp;does&nbsp;not&nbsp;represent&nbsp;a&nbsp;valid&nbsp;geography&nbsp;instance&nbsp;because&nbsp;it&nbsp;exceeds&nbsp;a&nbsp;single&nbsp;hemisphere.&nbsp;Each&nbsp;geography&nbsp;instance&nbsp;must&nbsp;fit&nbsp;inside&nbsp;a&nbsp;single&nbsp;hemisphere.&nbsp;A&nbsp;common&nbsp;reason&nbsp;for&nbsp;this&nbsp;error&nbsp;is&nbsp;that&nbsp;a&nbsp;polygon&nbsp;has&nbsp;the&nbsp;wrong&nbsp;ring&nbsp;orientation.\</message\>\</exception\>  
\</tracerecord\>

There&nbsp;appear&nbsp;to&nbsp;be&nbsp;quite&nbsp;a&nbsp;lot&nbsp;of&nbsp;SQL&nbsp;statements&nbsp;considering&nbsp;I&nbsp;just&nbsp;click&nbsp;once&nbsp;on&nbsp;the&nbsp;map&nbsp;-&nbsp;I&nbsp;will&nbsp;include&nbsp;them&nbsp;all&nbsp;just&nbsp;in&nbsp;case&nbsp;it&nbsp;is&nbsp;not&nbsp;the&nbsp;last&nbsp;line&nbsp;that&nbsp;is&nbsp;causing&nbsp;the&nbsp;crash:

WinformsMap1\_MouseDown():&nbsp;Triggered.&nbsp;Button&nbsp;clicked&nbsp;was&nbsp;Left  
  
e.SqlStatement=SELECT&nbsp;COUNT(\*)&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;VDateTime&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
e.SqlStatement=SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.types&nbsp;allTypes,&nbsp;sys.all\_views&nbsp;allViews&nbsp;WHERE&nbsp;allColumns.object\_id=allViews.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allViews.name='Vessels'union&nbsp;SELECT&nbsp;allTypes.name&nbsp;FROM&nbsp;sys.columns&nbsp;allColumns,&nbsp;sys.tables&nbsp;allTables,&nbsp;sys.types&nbsp;allTypes&nbsp;WHERE&nbsp;allColumns.object\_id=allTables.object\_id&nbsp;AND&nbsp;allColumns.user\_type\_id=allTypes.user\_type\_id&nbsp;AND&nbsp;allTypes.system\_type\_id=240&nbsp;AND&nbsp;allTables.name='Vessels'  
  
e.SqlStatement=SELECT&nbsp;ID,Name,UseMe,VLat,VLon,VDateTime,VSpd,VCMG,MaxSpeedEver,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc,FirstDateTime,Dimensions,Owner,Charterer,Origin,Label,Destination,ETA,Type\_Cargo,IMO\_No,CallSign,MsgType,Voltage,IO,OceanRegion,Temp,RPM,SigStrength,Altitude,WGS84Loc.STAsBinary()&nbsp;as&nbsp;WGS84Loc&nbsp;FROM&nbsp;Vessels&nbsp;WHERE&nbsp;(geography::STGeomFromText(@geography,4326).STIntersects(WGS84Loc)=1)&nbsp;&nbsp;AND&nbsp;VDATETIME&nbsp;\>=&nbsp;GETUTCDATE()-0.04166667;  
  
A&nbsp;first&nbsp;chance&nbsp;exception&nbsp;of&nbsp;type&nbsp;'System.Data.SqlClient.SqlException'&nbsp;occurred&nbsp;in&nbsp;MapSuiteCore.dll

&nbsp;

Hope&nbsp;you&nbsp;can&nbsp;understand&nbsp;all&nbsp;of&nbsp;that

---

<div class="post-metadata">

**Author:** ![Val](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/v/e56c9b/32.png) [@Val](https://community.thinkgeo.com/u/Val)\
**Post date:** [February 23, 2011, 2:59pm UTC](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576/20 "2011-02-23T14:59:25Z")

</div>

David,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;I&nbsp;hope&nbsp;you&nbsp;are&nbsp;still&nbsp;at&nbsp;work&nbsp;for&nbsp;the&nbsp;day.&nbsp;Yale&nbsp;will&nbsp;come&nbsp;in&nbsp;a&nbsp;little&nbsp;bit&nbsp;later&nbsp;today&nbsp;and&nbsp;I&nbsp;am&nbsp;trying&nbsp;to&nbsp;anticipate&nbsp;what&nbsp;he&nbsp;will&nbsp;need&nbsp;to&nbsp;solve&nbsp;your&nbsp;last&nbsp;problem.&nbsp;I&nbsp;think&nbsp;it&nbsp;will&nbsp;really&nbsp;help&nbsp;to&nbsp;have&nbsp;that&nbsp;"ShipLayer".&nbsp;Is&nbsp;there&nbsp;a&nbsp;way&nbsp;we&nbsp;could&nbsp;get&nbsp;it?&nbsp;Otherwise,&nbsp;we&nbsp;will&nbsp;try&nbsp;to&nbsp;figure&nbsp;out&nbsp;why&nbsp;the&nbsp;crash&nbsp;happens&nbsp;based&nbsp;on&nbsp;what&nbsp;you&nbsp;included&nbsp;in&nbsp;your&nbsp;last&nbsp;post.&nbsp;Thank&nbsp;you.

[Next page](https://community.thinkgeo.com/t/selecting-points-scale-issue/1576.md?page=2)
