I want to add 100 network elements to map by getting network element latitude and longtitude from my database, when I try to add 100 of them it doesnt add any image , when I add only one it displays the image at correct position. Here is my code
for (int i = 0; i < dt.Rows.Count; i++)
{
StringBuilder contentHtml = new StringBuilder();
contentHtml.Append("")
.Append(" CELL_NAME ")
.Append(dt.Rows[i]["CELL_NAME"].ToString()+".
")
.Append("");
InMemoryMarkerOverlay markerOverlay = new InMemoryMarkerOverlay("MarkerOverlay_"+i.ToString());
markerOverlay.Features.Add(dt.Rows[i]["CELL_ID"].ToString(), new Feature(Convert.ToDouble(dt.Rows[i]["LONGT"].ToString()), Convert.ToDouble(dt.Rows[i]["LAT"].ToString())));
markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage = new WebImage("Images/Network.ico", 20, 20);
markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.ContentHtml = contentHtml.ToString();
markerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level10;
//markerOverlay.Click += new EventHandler<MarkerOverlayClickEventArgs>(markerOverlay_Click);
Map1.CustomOverlays.Add(markerOverlay);
}
Latitude and Longtitude from database
When I give
for (int i = 0; i < dt.Rows.Count; i++) // count=100
it doesn’t draw any image
When i give
for (int i = 0; i < 5 ; i++)
it draws only 3 of them.
Should I use another method to put the images ?
Sorry for the wrong post It displays all of them. When I saw the map I thought that its finished. But when I looked at the progress bar i saw that it is still processing.I wait for a while and it displays all the images but it takes long time for 100 images . Is there a faster solution than InMemoryMarkerOverlay ?
Hi, Vesile
If you just add 100 markers to map control, that won't need so long time to render. I suggest you to check where the time is spent.Anyway, we have a API to suppress some markers which are too close together to improve the performance. Please give it a try. The bigger the size you are setting, the more count of markers will be suppressed which means less markers exists in the viewport. I think it can improve the performance.
inMemoryMarkerOverlay.SuppressingGridSize = 50;
If you have any question please let me know.
Thanks,
Khalil