While showing the locations based on the latitude and longitude you need to display the images associated with that object you are displaying the locaton for.
![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX4AAACpCAIAAACj9MGIAAAUM0lEQVR4nO2dzW/jyJnG+e/sIcdtcHTYvewimSTXxQLBbJKWHQXIIUAQYJNbbouM7NkIQTaTHOaw2GQDbABbngw009M96e2ZTGc+2ui2LXk8Lbvd8lfbbmus9shqyW2DOVAki2SRKkpUvUXW88MLQ6YoUnzfqodFSqrH+LuX/uUr//CKHXiMx2o+tg7/F5GzMP7+5R985R9fsQOP8VjNx+T9BJF6GOTvAIFAaBiQHgQCQRCQHgQCQRCQHgQCQRCGJczZ2Zn4ykB9UFAqNM+8ffiQHn1BQanQPPOQHt1BQanQPPOJpefZs2dTezOAABSUCs0zbx8+pEdfUFAqNM98YunpdDpTezOAABSUCs0zbx9+VqSnWSkYQwqVZuRqtVLs05NRKxmGUarJ2t3UkV7QWsnwmDxxvs2ltE05JM18rRTV8CZvgUlbdQq7Tiw9p6en4+xncpqVApucZqVSi1p12tJTKBTYMmVbeqQXlE1XuMVHrZlos9kgWeablUKhVCqwx5iu9CRq1Sns2j5843n/QiQuL6+eHB69eHEpuH56sT5nGjNLgiu/OWO8NNeY0jt5c8Z4aW7pNdN8rS5jd9MNioL609V4zTRmqyJrJtqs8pE08/X5l8z5dftv6JAnP/akrXrSXduHb1mW0Xs+EInLy6v9gycXLy4F108t6vOmMVuNfGpIsWovXCoaZrnOPggtrA5fVawO1uaGGzDn1r0152b9C90Ybqc641+/Pug9H1RnnLcys+Q9Fbcv9v1HHOA0g6KgbFEGvefrZXNYOH/2loqGL5mh3MZs1ttm7/mgV501zPk1fy3I858w8+tl0yzXB736vGnOrwUPmTn2UHeozoT7xaBXnzd9aYxp1dGdyPdgvWz69ity+BmRHi/jbCwV3UOtz5uReQksNAx7a9VZrxVWZ53Gt1R027e3MFikiL2MsS/ntdXZkMxNPZSSnugMx7w8Ynl11lUop+8xteA0Fdn5T5Z5r/07GsRPF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//qRQtITVh9Xesh7CyLFwKiHChLpWV757EH98/pnzebWdmtnd//g4PDw8N7yslrSE1AfjHpyGRj1UCFfet58+1ZjY/Ph5vbj1u7h4eHJyUm73W6323VCMxyRUY/rSEHeWxApBkY9VMiXnndu3t7abu3t7x8fH5+enp45UJrhiNzrcaUHo548BUY9VMiXnlu339/d2z86Omq322dnZ/Y8zcRmOAHpCetOp9NxzXDIewsixcCohwr50vP+X+7autPpdLrdbs+B0gyHlR6u7nQ6HdeRAqOePAVGPVTIl55PPr1Xrzeazc3HrdbBkyfHT58+PTkhNsNxpSdKd1jpIe8tiBQDox4q5EuPut9mjsc1w8GoJ0+BUQ8VkqVH0d9wJXKkIO8tiBQDox4qdM78mNKDUU+eAqMeKiA9VlIzHPLegkgxdO4AtOiceU96EpnhYNSTp8CohwpIj5XUDKczme8K/qr2FwDJuBqE8x4AgABIDwCAgL8BfJ6lklZ+xLsAAAAASUVORK5CYII=)
This is the database where we have stored the image information.
So in that case you need to make the use of images either from the datasource or from the current project to be used into the google API map display.
public string ConvertDataTabletoString()
{
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString))
{
using (SqlCommand cmd = new SqlCommand("select title=Company,lat=latitude,lng=longitude,image from MapDimension", con))
{
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
Dictionary<string, object> row;
foreach (DataRow dr in dt.Rows)
{
row = new Dictionary<string, object>();
foreach (DataColumn col in dt.Columns)
{
row.Add(col.ColumnName, dr[col]);
}
rows.Add(row);
}
return serializer.Serialize(rows);
}
}
function initialize() {
var markers = JSON.parse('<%=ConvertDataTabletoString() %>');
var mapOptions = {
center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
// marker:true
};
var infoWindow = new google.maps.InfoWindow();
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var image;
for (i = 0; i < markers.length; i++) {
var data = markers[i]
var myLatlng = new google.maps.LatLng(data.lat, data.lng);
var contentString = '<div id="content" style="margin-left:15px; margin-top:3px;overflow:hidden;">' +
'<div id="bodyContent">' + '<img src=' + data.image + ' style="width:172px;height:45px;" alt="WebStreet.in"/>' + '<br><font style="color:darkblue;font:11px tahoma;margin-left:5px;">' + data.title + ' Your Trusted IT Solutions Provider</font>' +
'</div>' +
'</div>';
//var marker = new google.maps.Marker({
//position: myLatlng,
//map: map,
//title: data.title,
//});
var marker = new google.maps.Marker({
map: map,
// draggable:true,
// animation: google.maps.Animation.DROP,
position: myLatlng,
title: data.title,
icon: '' // null = default icon
});
// Start of newly added code block
var infowindow = new google.maps.InfoWindow({
content: contentString,
width: 192,
height: 100
});
(function (marker, data) {
// Attaching a click event to the current marker
google.maps.event.addListener(marker, "click", function (e) {
infoWindow.setContent(data.description);
infowindow.open(map, marker);
});
//google.maps.event.addListener(marker, "mouseover", function (e) {
// infoWindow.setContent(data.description);
// infowindow.open(map, marker);
//});
})(marker, data);
}
// End of newly added code block
}
0 Comment(s)