// function to convert point.
function addPointToMap(lon, lat, imgPath) {
//var infoTemplate = new esri.InfoTemplate("${Title}", "Time: ${Time}<br />Location: ${Location}<br />Description: ${Description}<br/>");
var point = new esri.geometry.Point(lon, lat, new esri.SpatialReference({ wkid: 4326 }))
var convert_pt = ConvertTo3414(lat, lon) ;
console.log( "after conversion : " + JSON.stringify(convert_pt ) );
map.graphics.add(
new esri.Graphic(
new esri.geometry.Point(convert_pt.x, convert_pt.y, map.spatialReference),
new esri.symbol.PictureMarkerSymbol(imgPath, 25, 25)
)
);
}
//PAGE LOAD
for(var i = 0; i < jsonIncident.length; i++)
{
var lat = jsonIncident[i].Latitude
var lon = jsonIncident[i].Longitude
var imgPath;
var incidenttype = jsonIncident[i].IncidentType
if (incidenttype == "Road Work")
{
imgPath = "Images/roadworks.png"
}
if (incidenttype == "Vehicle Breakdown")
{
imgPath = "Images/breakdown.png"
}
if (incidenttype == "Accident")
{
imgPath = "Images/accident.png"
}
if (incidenttype == "Heavy Traffic")
{
imgPath = "Images/heavytraffic.png"
}
addPointToMap(lon, lat, imgPath);
}