3

I am trying to get the results of an identify task using ArcGIS JS API 2.7 into a featureSet so I can utilize this sample http://arcscripts.esri.com/details.asp?dbid=16528 that takes the results of a datagrid store and exports them to an excel file. I have it working where one feature is being exported, I just need to have all selected features export. Does an Identify Task produce a FeatureSet?

Thanks!

 function executeIdentifyTask(geom) {
  //clear the graphics layer 
  map.graphics.clear();

  identifyParams.geometry = geom;
  identifyParams.mapExtent = map.extent;
  identifyTask.execute(identifyParams,function(response){

 var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DOT, new dojo.Color([151, 249,0,.80]), 3), new dojo.Color([151, 249, 0, 0.45]));
     var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 20, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0]), 1), new dojo.Color([25,50,225,0.3]));

     var controlItems = [];
     var surveyItems = [];

     dojo.forEach(response,function(result){

       var feature = result.feature;

       if (result.layerName =="surveys"){
    showSurveysNameGrid();
        feature.setSymbol(polygonSymbol);
        searchType="selSurvey";
    surveyItems.push(attributes);
              var attributes = feature.attributes;
    var csvTextSurv = "DOCUMENT_N;TOWNSHIP_RANGE;SECTION\n";  


    csvTextSurv += attributes["DOCUMENT_N"] + ";" +
                           attributes["TOWNSHIP_RANGE"] + ";" +
                           attributes["SECTION"] + "\n";

        document.getElementById("csvSurv").value = csvTextSurv; 
        map.graphics.add(feature);
   }else{
     showPointNameGrid();
    feature.setSymbol(markerSymbol);
    var attributes = feature.attributes;
    controlItems.push(feature.attributes); 
    searchType="selControl"; 
    var csvTextMons = "POINT_NAME;SECTION\n";  

    csvTextMons += attributes["POINT_NAME"] + ";" +
                           attributes["TOWNSHIP_RANGE"] + ";" +
                           attributes["SECTION"] + "\n";
   }

     document.getElementById("csvMons").value = csvTextMons; 
   //add selected feature to graphics layer       
       map.graphics.add(feature);
 });

     if(surveyItems.length >0){
     showSurveysNameGrid();
     var surveysStore = new dojo.data.ItemFileReadStore({data:   {identifier:'DOCUMENT_N',items:surveyItems}});
        var grid = dijit.byId('grid5');
        grid.setStore(surveysStore);
     }
 if(controlItems.length >0){
    showPointNameGrid();
    var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
    var grid = dijit.byId('grid4');
        grid.setStore(controlStore);


 }              

 });

}

1
  • elaborate on what a featureset is?
    – Steve
    Mar 6, 2012 at 17:46

1 Answer 1

1

If by featureSet you are referring to the geoJson spec then the answer is no. The identify task returns an identifyResult[]. This contains some basic information about each result and a graphic representation of the geometry.

It looks like the script you are wanting to use wants CSV so where does a FeatureSet come into play?

4
  • Oops, I did not mean to end it there. I am not sure if the script I want to use needs a featureSet, I just can't figure out why I am only getting one result in my csv output, even though the datagrid displays all the results I select. It seems like it needs to loop through, but again I am not sure. Any ideas?
    – Em123
    Mar 6, 2012 at 19:10
  • might it be since you are overriding the place you are storing it? ie document.getElementById("csvSurv").value = csvTextSurv; where csvTextSurv is always going to be the last item?
    – Steve
    Mar 6, 2012 at 22:24
  • Good point. I am such a newbie, what would I use instead to keep this from happening?
    – Em123
    Mar 7, 2012 at 19:40
  • += would append.
    – Steve
    Mar 8, 2012 at 0:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.