Hi all, I have a questions, It's easy to add markers/polyline e.t.c but I have a problem to delete some of them(not delete the whole bunch) when updating the map from a timer event. ( I need to hide/delete the old posistions and add new ones)
So please show how to loop trough the overlay collection and find the marker ID and find the ones I want to delete ?
Is it possible to add many markers as a single group/layer and just show/hide this group. with a few lines of code ? instead of looping trough the whole collection ?
Another problem is that my map application is growing over time ( ~1 hour ) until the browser can’t access more memory and the browser freezes
-------------------------------------------------------------------------------------------------------------------------------------------
SQLCONN.Open()
Dim SQLCMD As New SqlCommand("SELECT * FROM dbo.geotest", SQLCONN)
Dim RESULT As SqlDataReader = SQLCMD.ExecuteReader
Dim BLN, MRK, POLY As String
Dim POS As GoogleLatLng
Dim GMRK As GoogleMarker
Dim GPOLY As GooglePolyline
While RESULT.Read
POS = New Reimers.Map.GoogleLatLng(RESULT("latitude").ToString(), RESULT("longitude").ToString())
GMRK = New Reimers.Map.GoogleMarker("testmrk" & Guid.NewGuid.ToString, RESULT("latitude").ToString(), RESULT("longitude").ToString())
GPOLY = New Reimers.Map.GooglePolyline("testpoly" & Guid.NewGuid.ToString, GooglePolyline.DrawCircle(POS, RESULT("radius").ToString(), Units.Metric, 45), System.Drawing.Color.Salmon, 5)
GPOLY.Opacity = "0.5"
BLN = "<img src=IMAGES/GEO16.PNG> <b>Geozon</b><br/><br/>Adress <b>" & RESULT("street") & ", " & RESULT("city") & "</b><br/><br/>Radie <b>" & RESULT("radius") & " Km</b>"
GMRK.ClientSideHandlers.OnMouseOver = GMRK.OpenInfoWindowHTML(gmap, BLN)
gmap.Overlays.Add(GMRK)
gmap.Overlays.Add(GPOLY)
MRK = gmap.AddOverlay(GMRK)
POLY = gmap.AddOverlay(GPOLY)
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "GEOZONEPOLYLINE" & Guid.NewGuid.ToString, POLY, True)
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "GEOZONEMARKER" & Guid.NewGuid.ToString, MRK, True)
End While
SQLCONN.Close()
End Sub