Issues adding point graphics from FindTask

317
0
06-04-2014 06:51 AM
RyanSellman
Occasional Contributor II
I am building an application where there are multiple FindTasks, each searching a different layer within a single service.  When the FindTask results are returned, I want a simple graphic drawn.  I have no problem drawing graphics from a polygon layer or line layer but for some reason when find results are returned from a search on a point layer, they will not draw.  I'm sure there is something simple that I am missing.  Any help is much appreciated!!

Here's some code showing the three FindTasks I have wired up, the first of which being the point layer search:

//start does valve search
   
   findValveTask = new FindTask("http://summitgis.summitoh.net:6080/arcgis/rest/services/DOES/MapServer/");
   
   map.on("load", function () {
    findValveParams =  new FindParameters();
    findValveParams.returnGeometry = true;
    findValveParams.layerIds = [0];
    findValveParams.searchFields = ["UNAME"];
    findValveParams.outSpatialReference = map.spatialReference;
   }); 
   
   function doDoesValveFind() {
   findValveParams.searchText = dom.byId("doesValveText").value;
   findValveTask.execute(findValveParams, showResults);
   }
   
   //This function works with an array of FindResult that the task returns and then //create array of attributes
   function showResults(results) {
                map.graphics.clear();
                var symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10,
        new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
        new Color([98, 194, 204]), 2),
        new Color([98, 194, 204, 0.5])
        );
    arrayUtils.map(results, function (result) {
     var graphic = result.feature;
     graphic.setSymbol(pointSymbol);
     map.graphics.add(graphic);
     return result.feature.attributes;  
    });
   }
   
   //end does valve search
   
   //start does sewer line search
   
   findSewerLineTask = new FindTask("http://summitgis.summitoh.net:6080/arcgis/rest/services/DOES/MapServer/");
   
   map.on("load", function () {
    findSewerLineParams =  new FindParameters();
    findSewerLineParams.returnGeometry = true;
    findSewerLineParams.layerIds = [10];
    findSewerLineParams.searchFields = ["PIPEID"];
    findSewerLineParams.outSpatialReference = map.spatialReference;
   }); 
   
   function doDoesSewerLineFind() {
   findSewerLineParams.searchText = dom.byId("doesSewerLineText").value;
   findSewerLineTask.execute(findSewerLineParams, showResults);
   }
   
   //This function works with an array of FindResult that the task returns and then //create array of attributes
   function showResults(results) {
                map.graphics.clear();
                var symbol = 
     new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
     new Color([0, 255, 255]), 4);
    arrayUtils.map(results, function (result) {
     var graphic = result.feature;
     graphic.setSymbol(symbol);
     map.graphics.add(graphic);
     return result.feature.attributes;  
    });
   }
   
   //end does sewer line search
   
   //start does district search
   
   findDistrictTask = new FindTask("http://summitgis.summitoh.net:6080/arcgis/rest/services/DOES/MapServer/");
   
   map.on("load", function () {
    findDistrictParams =  new FindParameters();
    findDistrictParams.returnGeometry = true;
    findDistrictParams.layerIds = [12];
    findDistrictParams.searchFields = ["NAME"];
    findDistrictParams.outSpatialReference = map.spatialReference;
   }); 
   
   function doDoesDistrictFind() {
   findDistrictParams.searchText = dom.byId("doesDistrictText").value;
   findDistrictTask.execute(findDistrictParams, showResults);
   }
   
   //This function works with an array of FindResult that the task returns and then //create array of attributes
   function showResults(results) {
                map.graphics.clear();
                var symbol = 
     new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
                    new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, 
     new Color([98, 194, 204]), 2), 
     new Color([98, 194, 204, 0.5])
     );
    arrayUtils.map(results, function (result) {
     var graphic = result.feature;
     graphic.setSymbol(symbol);
     map.graphics.add(graphic);
     return result.feature.attributes;  
    });
   }
   
   //end does district search
0 Kudos
0 Replies