Yale:
Yes, I wanted to to do a spatial query in the event of windormsMap1.TrackOverlay.TrackEnded event, following is my code snippet. I noticed the program still retrieves the data from the database server. As I said in this post:
gis.thinkgeo.com/Support/Dis....aspx#8922
When I created the postgreSQLFeature layer, I passed in the query string to select all the columns from the database,but the program only retrieved the 3 of them. So when I do a spatial query in the windformsMap1.TrackOverlay.TrackEnded event, the program retrieves all columns data from the database again.
My questions is, why not retrieve all the columns data when the postgreSqlFeature layer is displayed?
If CType(mnuBar.Items(VESSELRADIUSSEARCH_CMD_ID), ToolStripButton).Checked = True And Map1.TrackOverlay.TrackMode = TrackMode.Circle Then
Dim feature1 As Feature
If Map1.TrackOverlay.TrackShapeLayer.InternalFeatures.Count = 0 Then
Exit Sub
Else
feature1 = Map1.TrackOverlay.TrackShapeLayer.InternalFeatures.Item(Map1.TrackOverlay.TrackShapeLayer.InternalFeatures.Count - 1)
If feature1.GetWellKnownType <> WellKnownType.Polygon Then
Exit Sub
End If
End If
Try
Map1.TrackOverlay.Lock.EnterWriteLock()
Map1.TrackOverlay.TrackShapeLayer.InternalFeatures.RemoveAt(Map1.TrackOverlay.TrackShapeLayer.InternalFeatures.Count - 1)
Dim selectedFeatures As Collection(Of Feature)
Dim postgreLyr As FeatureLayer = Map1.FindFeatureLayer("VesselPointsLayer")
If postgreLyr Is Nothing Then
MsgBox("Vessel data is not available.")
Exit Sub
End If
postgreLyr.Open()
selectedFeatures = postgreLyr.QueryTools.GetFeaturesIntersecting(feature1, vesselReturningColumns)
postgreLyr.Close()
If selectedFeatures.Count > 0 Then
Me.DataGridView1.DataSource = MapEngine.LoadDataTable(selectedFeatures, vesselReturningColumns)
UpdateInfoWindowForVessel()
Else
Me.DataGridView1.DataSource = Nothing
End If
Catch ex As Exception
swLog.WriteLine("TrackEndedEventHandler VesselRadiusSearch exception=" & ex.Message & " Time=" & Now.ToShortTimeString)
swLog.Flush()
Finally
Map1.TrackOverlay.Lock.ExitWriteLock()
Map1.Refresh()
End Try
End IF