Click here to Skip to main content
15,908,013 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've built one application where i am using google maps. Here is the code snippets
GooglePoint GP1 = new GooglePoint();
        GP1.ID = "1";
        GP1.Latitude = 43.65669;
        GP1.Longitude = -79.44268;
        GP1.InfoHTML = "This is point 1";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);

Now i want to create this point dynamically inside a loop. So how can i do that?

Thanks in advance.
Posted
Comments
OriginalGriff 10-Aug-14 4:34am    
Since you have deleted your comment, I assume you have worked out that I can't know where your actual point coordinates come from and have solved that part yourself?
If not, let me know...
sahabiswarup 10-Aug-14 4:57am    
After applying your logic it works. But now i want to draw a pentagon in google maps. Here is the logic
GooglePoint GP1 = new GooglePoint();
GP1.ID = "GP1";
GP1.Latitude = 22.539547;
GP1.Longitude = 88.263067;

GooglePoint GP2 = new GooglePoint();
GP2.ID = "GP2";
GP2.Latitude = 22.543326;
GP2.Longitude = 88.284530;
GooglePolygon PG1 = new GooglePolygon();
PG1.ID = "PG1";
PG1.FillColor = "#0000FF";
PG1.FillOpacity = 0.4;
PG1.StrokeColor = "#0000FF";
PG1.StrokeOpacity = 1;
PG1.StrokeWeight = 2;
PG1.Points.Add(GP1);
PG1.Points.Add(GP2);
GoogleMapForASPNet1.GoogleMapObject.Polygons.Add(PG1);

Now i want to draw the pentagon dynamically, fetch latitude and longitude from database. So how can that be possible?

1 solution

Well... it's trivial...
C#
for (int i = 1; i < 10; i++)
    {
    GooglePoint GP1 = new GooglePoint();
    GP1.ID = i.ToString();
    GP1.Latitude = 43.65669;
    GP1.Longitude = -79.44268;
    GP1.InfoHTML = string.Format("This is point {0}", i);
    GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900