Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function addPlaceGraphic(item, symbol) {
- map.graphics.clear();
- var place = {};
- var attributes, infoTemplate, pt, graphic;
- pt = item.feature.geometry;
- place.address = item.name;
- place.score = item.feature.attributes.score;
- var trashQuery = runPWQuery(pt, trashLayer, "trash");
- var yardQuery = runPWQuery(pt, yardWasteLayer, "yardwaste");
- var recycleQuery = runPWQuery(pt, recyclingLayer, "recycling");
- all([trashQuery, yardQuery, recycleQuery]).then(function (results) {
- //receive query responses, update attributes and add graphics
- attributes = { trashQuery: pt.trashLayer, recycleQuery: pt.recyclingLayer, yardQuery: pt.yardWasteLayer };
- infoTemplate = new InfoTemplate();
- infoTemplate.setTitle("Scheduling Information");
- infoTemplate.setContent("Trash: ${trashQuery}<br/>Recycling: ${recycleQuery}<br/>Mixed Bulk: ${yardQuery}");
- graphic = new Graphic(pt, symbol, attributes, infoTemplate);
- //add to map
- map.graphics.add(graphic);
- map.centerAt(pt);
- });
- }
- function runPWQuery(in_geometry , in_fl , in_container_id) {
- var query = new esri.tasks.Query();
- query.returnGeometry = true;
- query.outFields = ["*"];
- query.geometry = in_geometry;
- var promise = in_fl.queryFeatures(query, function(myresponse, io) {
- var temp_val;
- var values = [];
- var tstr;
- for (var il = 0; il < myresponse.features.length; il++) {
- if (myresponse.features[il].attributes["MONDAY"] == "Yes") {
- temp_val = "Monday";
- }
- else if (myresponse.features[il].attributes["TUESDAY"] == "Yes") {
- temp_val = "Tuesday";
- }
- else if (myresponse.features[il].attributes["WEDNESDAY"] == "Yes") {
- temp_val = "Wednesday";
- }
- else if (myresponse.features[il].attributes["THURSDAY"] == "Yes") {
- temp_val = "Thursday";
- }
- else if (myresponse.features[il].attributes["FRIDAY"] == "Yes") {
- temp_val = "Friday";
- }
- else {
- //temp_val = "Other";
- temp_val = myresponse.features[il].attributes["DESCRIPT"];
- }
- }
- var statCount = myresponse.features.length;
- if (statCount >= 1) {
- $("#" + in_container_id).html(temp_val);
- }
- else {
- $("#" + in_container_id).html("");
- }
- return temp_val;
- }, function (error) {
- console.log(dojo.toJson(error, true));
- });
- //return promise
- return promise;
- }
- function renderPWQuery() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement