I cant find the way to create overlays on the static google map through database. I can acheive the a single marker(location) easily. below is the code:
int mapID = Convert.ToInt16(hdnMapID.Value);
SqlDataReader dr = Maps.GetMapPointsByMapIDUserID(mapID, userID);
string latitude = "53.615143";
string longitude = "-1.711380";
string center = "" + latitude + "," + longitude + "";
string zoom = "20";
string size = "512x512";
string maptype = "roadmap";
while (dr.Read())
{
map2.ImageUrl = "http://maps.google.com/maps/api/staticmap?center=" + center + "&zoom=" + zoom + " &size=" + size + "&maptype=" + maptype + "&markers=color:blue|label:S|" + dr["lat"] + ", " + dr["lng"] + "&sensor=true";
}
cnt++;
}
dr.Dispose();
In the above url, its easy to pass marker value (color:blue|label:S|”+ dr[“lat”] + “,” + dr[“lng”] +) for a single location, but in my project I have got multiple locations and I cant find a way to create different urls for multiple locations for instance if there are two locations there will be 2 markers in the above url, how can I create programatically google static url depending on the numbers of markers(overlays) present in the map.
Any tutorial or help will be highly appreciated
Edition of the post #1 by M’vy
Ok. I think I got the point. So I edit the answer to use the code snippet.
The following code has to be used for ONE
mapIdThe
markerIdis of no use. You can easily compute the value by usingSELECT COUNT(*) FROM Table WHERE mapID = 581;
First Post
Hello Muhammad,
You can find your answer in the Google Map Static API here
For multiple markers, you just have to repeat the markers parameter in the URL.
You can choose a different color, name etc. Just append a new
&markers=<blah blah>M’vy