Large number of GoogleCirclePolygons

Mar 16, 2010 at 9:15 PM

Hi,

Wonderful control - thank you so much for sharing it with us all :o)

My question:

Background

I have a GoogleMap onto which I need to place a great number of GoogleCirclePolygons (300-10,000). These polygons are the results of a database query.

I draw these polygons on Page_Load, by calling the following routine:


  protected void Page_Load( object sender, EventArgs e )
  {
    ...

    googleMapFeatureMap_PlotItems()

    ...

  }

 

protected void googleMapFeatureMap_PlotItems()

    // centre map on UK:
    string[] Pos = Global.GetXY("<A Place in the UK>");
   
    float Lat = float.Parse(Pos[2]);
    float Lon = float.Parse(Pos[3]);
    int radius = 500;
   
    // draw a GoogleCirclePolygon for each record Item in Items
    gmUKOverview.Polygons.Clear();
    List<MyItem> Items = RunASQLQuery( Lat, Lon, radius, "", 0, 1000 );
    foreach (Item I in Items)
    {
      GoogleMarker GM = new GoogleMarker(I.Latitude, I.Longitude);
      GoogleCirclePolygon C = new GoogleCirclePolygon();
      C.Latitude = R.Latitude;
      C.Longitude = R.Longitude;
      C.Radius = 10;
      C.FillOpacity = 0.5F;
      C.StrokeWeight = 1;
      C.StrokeOpacity = 0.0F;
      C.FillColor = System.Drawing.Color.Green;
      gmUKOverview.Polygons.Add(C);
      gmUKOverview.Markers.Add(GM);
    }

    // Centre map 
    gmUKOverview.Latitude = Lat;
    gmUKOverview.Longitude = Lon;
    gmUKOverview.Zoom = 6;

  }

Questions 

1. However my problem is that this takes a LONG time to draw all of the GoogleCirclePolygons on Page Load, is there any way to speed it up?

I have looked at drawing them, then making the map static (since they do not change often), but:

  (a) I dont know how to save the image of the map, and
  (b) GoogleCirclePolygons will not show on the IMage is that correct?

2. Finally, whatever the solution is, I would still like to be able to click on the map and retrieve the (Lat, Lon) to some Client Side Event handler - any way to do this also?