//map is pulled from a webmap id
var graphicsLayer = new esri.layers.GraphicsLayer({
infoTemplate: template,
outFields: ["*"]
});
var graphicsLayer2 = new esri.layers.GraphicsLayer({
infoTemplate: template,
outFields: ["*"]
}); //create an artboard for our beautiful markers to rest on
map.addLayers([graphicsLayer, graphicsLayer2]);
function getIdResults(ids, sortOrder, sortby) {
map.resize(true);
map.hideZoomSlider();
var resData = {'T_IDTrans':ids, 'sortbyfield':sortby, 'sortbylist':sortOrder};
//reset the map position for seacrh
//this is done because the window resizes and causes the map to be left of stg.
var origin = esri.geometry.Point(-113.5581, 37.0953);
map.centerAndZoom(origin, 12);
graphicsLayer2.clear() //clean up
graphicsLayer.clear();//give us a clean map
usedCoordinates = []; //initialize and/or clear the coordinates used
$.ajax({
//Grab all the json data. Removed this because it is a lot of code
var point;
var symbol = new PictureMarkerSymbol(
{
//symbol info
});
var graphic; //initialize graphic variable. This is what will be added to the graphic layer
var checkbox = //corresponds to a toolbar check box
'<input id="p_check_m_'
+ item.mls
+ //more gibberish to make the checkbox
var content = '<div><b>' //the body of the info window
+ item.SaleLease
+ '</b></div><div>Listing: '
+ item.T_ListBrokerage
+ ' / '
+ item.T_ListAgent
+ buying
+ '</div>'
+ '<div>List Date:' + item.T_ListDate + '</div>'
+ '<div>List Price:' + item.price + '</div>'
+ '<div>' + addCommas(area) + '</div>';
point = new esri.geometry.Point(item.lon, item.lat); //point for graphic
coordinateCheck = item.lat;
//I just use latitude since I do not know how to check an array of arrays
graphic = new esri.Graphic(point, symbol); //create the graphic
graphic.setAttributes({'title': checkbox, 'desc': content}); //set its attributes
if (usedCoordinates.indexOf(coordinateCheck) > -1){
//check to see if item.lat has already been used
graphicsLayer2.add(graphic);
console.log('added to layer 2');
} else {
graphicsLayer.add(graphic);
usedCoordinates.push(coordinateCheck);
console.log('added to layer 1 ' + usedCoordinates);
}
});
/*dojo.forEach(graphicsLayer.graphics, function(relate){
var u;
});*/
updateContainer();