Move the circle without reloading the map

Jul 9, 2012 at 10:33 AM
Edited Jul 9, 2012 at 11:18 AM

Hi.

First i want to say this project is awesome :)

My problem is that i have a mobile webviw app that uses positions from a database.
I need to reposition the circle every 10 seconds from the database, but i can only manage this by reloading the whole map.

Is there any way to just move the circle?

Here is my code:

WEB code:

 

            <asp:UpdatePanel ID="UpdatePanel1" runat="server" OnLoad="UpdatePanel1_Load" UpdateMode="Conditional">
                <ContentTemplate>
                        <asp:Timer ID="Timer1" runat="server" Interval="10000" OnTick="Timer1_Tick" />
                    <asp:Label ID="lastupdate" runat="server" />
                    <div class="map-wrap" style="width: 100%; height: 100px;">
                        <artem:GoogleMap ID="GoogleMap1" runat="server" MapType="ROADMAP" Width="100%" Height="100px" />
                    </div>                
                </ContentTemplate>
            </asp:UpdatePanel>

 

 

Code Behind:

 

    protected void UpdatePanel1_Load(object sender, EventArgs e)
    {
        BuildMap();
    }

    protected void Timer1_Tick(object sender, EventArgs e)
    {
        //update the update panel every 10 seconds
        UpdatePanel1.Update();
    }
    
    
    private void BuildMap()
    {
        double lat, lng;
        string getLocations = "SELECT ChLatCurrent,ChLonCurrent FROM LatLonAuto WHERE UserID = 'paal';";

        dt = dbClass.ConnectDataBaseReturnDT(getLocations);

            lat = Convert.ToDouble(r["ChLatCurrent"]);
            lng = Convert.ToDouble(r["ChLonCurrent"]);

            GoogleMap1.Zoom = 15;
            GoogleMap1.Center.Latitude = lat;
            GoogleMap1.Center.Longitude = lng;

            var circle = new GoogleCircle
            {
                Center = new LatLng(lat, lng),
                Radius = 5
            };

            GoogleMap1.Overlays.Add(circle);
            lastupdate.Text = DateTime.Now.ToString();
    }

Thanks in advance

Paal