Posted By Yale on 06-08-2009 02:06 AM
Rose,
We will double check the time doubled as you said.
I think the two reason for the second time to query the Postgre Server is that when we draw, we will fetch data from the later with the column required.
I am wondering whether you put the subset of the first query into another PostgreSqlLayer, if so, try to put it into a InmemoryFeatureLayer as your another post talked about.
Thanks for your reply and questions.
Yale.
Yale:
I checked the program again, and narrowed down the problem. I think there is a refresh issue in this intrim release: 3.0.314 which does not have in release 307.
Following is my code snippet which creates the PostgreSQLFeatureLayer, same as release 307, after about 3 minutes, the code after Map1.Refresh() was executed, and it printed the Time=165, and my window cursor was set to default. After half an hour instead of one hour, I tried to pan and zoom in the map, I noticed the program sent another query to the database server to query the “TrueHeading” and the geometry columns for display. If I don’t do anything on the map for example pan/zoom in/out, the data will never get displayed. After I added this line of code(Map1.Overlays(“VesselPointsOverlay”).Lock.isDirty=true) before Map1.Refresh(), the problem got fixed. p>
Dim rectangleShape1 As RectangleShape = Map1.CurrentExtent
Dim projWGS84ToMercator As New Proj4Projection(" updated="" and="" ais_geom="" where="" aismessages1="" from="" select="" as="" vesselsview="" view="" replace="" or="" create="">= Date ‘2009-06-04’ AND updated< Date ‘2009-06-09’" Dim time1 As Date = Now Dim VesselPointsLayerview As New PostgreSqlFeatureLayer(connectString, “aismessages1”, “aismessages1_id”) VesselPointsLayerview.CommandTimeout = 6000 VesselPointsLayerview.Srid = 4326 VesselPointsLayerview.Open() VesselPointsLayerview.ExecuteNonQuery(sPointDataQryString) VesselPointsLayerview.Close() Dim VesselPointsLayer As New PostgreSqlFeatureLayer(connectString, “vesselsview”, “aismessages1_id”) VesselPointsLayer.Srid = 4326 VesselPointsLayer.CommandTimeout = 6000 VesselPointsLayer.FeatureSource.Projection = projWGS84ToMercator Try VesselPointsLayer.Open() Console.WriteLine(“VesselPointsLayer=” & VesselPointsLayer.QueryTools.GetCount) If CType(VesselPointsLayer.FeatureSource, PostgreSqlFeatureSource).GetCount() = 0 Then MsgBox(“No data selected”) Me.Cursor = Cursors.Default Exit Sub End If VesselPointsLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear() VesselPointsLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(New RotatePointStyle(New PointStyle(New GeoImage(appPath & “activated0000.png”)), “trueheading”)) VesselPointsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 Catch ex0 As Npgsql.NpgsqlException MsgBox(“Too much data, please limit your selection to a smaller set and try again.”) Finally VesselPointsLayer.Close() End Try If Map1.FindFeatureLayer(“VesselPointsLayer”) Is Nothing = True Then Dim staticOverlay As New LayerOverlay() staticOverlay.Layers.Add(“VesselPointsLayer”, VesselPointsLayer) Map1.Overlays.Add(“VesselPointsOverlay”, staticOverlay) Else Try Map1.Overlays(“VesselPointsOverlay”).Lock.EnterWriteLock() CType(Map1.Overlays(“VesselPointsOverlay”), LayerOverlay).Layers.RemoveAt(0) CType(Map1.Overlays(“VesselPointsOverlay”), LayerOverlay).Layers.Add(“VesselPointsLayer”, VesselPointsLayer) Catch ex1 As Exception swLog.WriteLine(“DownloadPointData Exception::” + ex1.Message() + " Time is: " + DateTime.Now) swLog.Flush() Finally Map1.Overlays(“VesselPointsOverlay”).Lock.ExitWriteLock() End Try End If Map1.Refresh() Console.WriteLine(“Time=” & DateDiff(DateInterval.Second, time1, Now)) Catch ex As Exception swLog.WriteLine(“DownloadPointData Exception::” + ex.Message() + " Time is: " + DateTime.Now) swLog.Flush() Finally Me.Cursor = Cursors.Default End Try
Rose