Издание поста № 1 от M'vy
Ок.Я думаю, что понял.Поэтому я редактирую ответ, используя фрагмент кода.Следующий код должен использоваться для ONE mapId
int mapID = Convert.ToInt16(hdnMapID.Value);
/* I suppose this executes the following SQL query :
* SELECT lat, lng FROM Table WHERE mapID = :mapID;
*/
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";
/* This is the basic link, with no markers */
string URLStart = "http://maps.google.com/maps/api/staticmap?center=" +
center + "&zoom=" + zoom + " &size=" + size + "&maptype=" + maptype + "&sensor=true";
string markersStr = "";
/* Each record we will read correspond to one point on the map:
* NB you don't need the markerID
* We add each point long and lat to the string */
while (dr.Read()) {
markersStr += "&markers=color:blue|label:S|" + dr["lat"] + ", " + dr["lng"] + ;
}
map2.ImageUrl = URLStart + markersStr;
dr.Dispose();
//Then display the map with the URL that has all the point for mapId
markerId
бесполезен.Вы можете легко вычислить значение, используя SELECT COUNT (*) FROM Table, WHERE mapID = 581;
Первое сообщение
Привет Мухаммед,
Вы можете найти свой ответ в Google Map Static API здесь
Для нескольких маркеров вам просто нужно повторить параметр маркеров в URL.Вы можете выбрать другой цвет, имя и т. Д. Просто добавьте новый &markers=<blah blah>
M'vy