I have a set of coordinates that is loaded from database. I would like to detect all the loaded markers that are close to each others which is within a certain distance.so the code is something likefunction locatePOI() { // Places of Interest
var Grid_Table = document.getElementById('PrimarySchoolDGV');
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET", "/Foreigners@SG/WebService.asmx/getPlacesOfInterests", false);
xmlhttp.send();
var xmlDoc = xmlhttp.responseXML;
var xmlalbums = xmlDoc.documentElement.getElementsByTagName("PlacesOfInterest");
$.each(xmlalbums, function () {
testindex = 0;
var school = $(this).find("Name").text();
var address = $(this).find("Address").text();
var postalcode = $(this).find("PostalCode").text();
var cat = $(this).find("Category").text();
var incidentI = "";
coordX = $(this).find("X").text();
coordY = $(this).find("Y").text();
var point = new esri.geometry.Point({ "x": coordX, "y": coordY, "spatialReference": { "wkid": 3414} });
if(pointsbetweeneachother < 3km)
{
// do something here
}
var symbol = new esri.symbol.PictureMarkerSymbol('images/icons/Interest-icon1.png', 25, 25);
//symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, safetyLevelRadiusSize * 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([r, g, b, 0.5]), 10), new dojo.Color([r, g, b, 0.9]));
var infoTemplate = new esri.InfoTemplate();
infoTemplate.setTitle("<img src='images/icons/interest-icon.png' style='width:25px; height:25px;'/> " + school);
infoTemplate.setContent("<b>Food Establishments : </b>" + school + "</br>"
+ "<b>Address: </b>" + address + "<br/>"
+ "<b>PostalCode: </b>" + postalcode + "<br/>"
+ "<b>Category: </b>" + cat + "<br/>"
);
var graphic = new esri.Graphic(point, symbol);
map.graphics.add(graphic);
graphic.setSymbol(symbol);
graphic.setInfoTemplate(infoTemplate);
}
);
}
can anyone help me with this?