+ Reply to Thread
Results 1 to 8 of 8

Thread: Display Results for 2 Layers?

  1. #1
    Emily LaMunyon
    Join Date
    Sep 2010
    Posts
    169
    Points
    6
    Answers Provided
    1


    0

    Default Display Results for 2 Layers?

    Hi all,

    I have a Javascript web map in which the user manually selects layers by dragging a box, using the Identify Task. I have it working where if features from one layer are selected, the results are displayed in a datagrid. The problem I am having is if two layers overlap and the user selects them both, I can't figure out how to display results for both. I have tried multiple things and am yet to come up with a solution. I am open to either having both datagrids displayed at the bottom, or giving the user a choice through a pop-up window of which grid results to show. The last chunk of the else/if statement where I try to put both the layers together does not seem to be working....any ideas????

    Thanks so much!!!

    Code:
     dojo.connect(map, 'onLoad', function(theMap) {
         
          navToolbar.deactivate();
               identifyTask = new esri.tasks.IdentifyTask("http://slcarcgisdev1/SLCOGIS/rest/services/public/Surveyor/MapServer");
               
               identifyParams = new esri.tasks.IdentifyParameters();
               identifyParams.tolerance = 3;
               identifyParams.returnGeometry = true;
               identifyParams.layerIds = [0,2];
               identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
               identifyParams.width  = map.width;
               identifyParams.height = map.height;
           
           
              //initialize the toolbar
              toolBar = new esri.toolbars.Draw(map);
              dojo.connect(toolBar, "onDrawEnd",onDrawEnd);          
              navToolbar.deactivate();
              //resize the map when the browser resizes
              dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
              
              
            });
    
             
             
           
          
          function onDrawEnd(extent){
              navToolbar.deactivate();
              executeIdentifyTask(extent);
          }
          
          
     function executeIdentifyTask(geom) {
            //clear the graphics layer 
               map.graphics.clear();
            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]));
            
            identifyParams.geometry = geom;
            identifyParams.mapExtent = map.extent;
            identifyTask.execute(identifyParams,function(response){
                var controlItems = [];
                var surveyItems = [];
                       
               dojo.forEach(response,function(result){
                   var feature = result.feature;
                    //add selected feature to graphics layer
                    feature.setSymbol(polygonSymbol);
                    feature.setSymbol(markerSymbol);
                    map.graphics.add(feature);
                    
                   if(result.layerName === 'Control Points'){
                   showPointNameGrid();
                   controlItems.push(feature.attributes);
                   searchType = "selControl";
                  var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
                  var grid = dijit.byId('grid4');
                  grid.setStore(controlStore);
                     
                   
             
             }else if(result.layerName === 'surveys'){
                    	
               showSurveysNameGrid();
               surveyItems.push(feature.attributes);
               searchType="selSurveys";
               var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT_N',items:surveyItems}});
               var grid = dijit.byId('grid5');
               grid.setStore(surveysStore);
             
               
              }else if((result.layerName === 'surveys') && (result.layerName === 'Control Points')){
                showSurveysNameGrid()             
                surveyItems.push(feature.attributes);  
                showPointNameGrid();
                controlItems.push(feature.attributes);  
                
               
                
                
                var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT',items:surveyItems}});
                var grid = dijit.byId('grid5');
               grid.setStore(surveysStore);
              
                
                var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
                var grid = dijit.byId('grid4');
               grid.setStore(controlStore);
              
             
               
               }
                    
                    
                   
               });
               
               
             
    
    		
               
              
            });
    
    
          }

  2. #2
    Heming Zhu

    Join Date
    May 2010
    Posts
    514
    Points
    47
    Answers Provided
    7


    0

    Default Re: Display Results for 2 Layers?

    Quote Originally Posted by elove View Post
    Hi all,

    I have a Javascript web map in which the user manually selects layers by dragging a box, using the Identify Task. I have it working where if features from one layer are selected, the results are displayed in a datagrid. The problem I am having is if two layers overlap and the user selects them both, I can't figure out how to display results for both. I have tried multiple things and am yet to come up with a solution. I am open to either having both datagrids displayed at the bottom, or giving the user a choice through a pop-up window of which grid results to show. The last chunk of the else/if statement where I try to put both the layers together does not seem to be working....any ideas????

    Thanks so much!!!

    Code:
     dojo.connect(map, 'onLoad', function(theMap) {
         
          navToolbar.deactivate();
               identifyTask = new esri.tasks.IdentifyTask("http://slcarcgisdev1/SLCOGIS/rest/services/public/Surveyor/MapServer");
               
               identifyParams = new esri.tasks.IdentifyParameters();
               identifyParams.tolerance = 3;
               identifyParams.returnGeometry = true;
               identifyParams.layerIds = [0,2];
               identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
               identifyParams.width  = map.width;
               identifyParams.height = map.height;
           
           
              //initialize the toolbar
              toolBar = new esri.toolbars.Draw(map);
              dojo.connect(toolBar, "onDrawEnd",onDrawEnd);          
              navToolbar.deactivate();
              //resize the map when the browser resizes
              dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
              
              
            });
    
             
             
           
          
          function onDrawEnd(extent){
              navToolbar.deactivate();
              executeIdentifyTask(extent);
          }
          
          
     function executeIdentifyTask(geom) {
            //clear the graphics layer 
               map.graphics.clear();
            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]));
            
            identifyParams.geometry = geom;
            identifyParams.mapExtent = map.extent;
            identifyTask.execute(identifyParams,function(response){
                var controlItems = [];
                var surveyItems = [];
                       
               dojo.forEach(response,function(result){
                   var feature = result.feature;
                    //add selected feature to graphics layer
                    feature.setSymbol(polygonSymbol);
                    feature.setSymbol(markerSymbol);
                    map.graphics.add(feature);
                    
                   if(result.layerName === 'Control Points'){
                   showPointNameGrid();
                   controlItems.push(feature.attributes);
                   searchType = "selControl";
                  var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
                  var grid = dijit.byId('grid4');
                  grid.setStore(controlStore);
                     
                   
             
             }else if(result.layerName === 'surveys'){
                    	
               showSurveysNameGrid();
               surveyItems.push(feature.attributes);
               searchType="selSurveys";
               var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT_N',items:surveyItems}});
               var grid = dijit.byId('grid5');
               grid.setStore(surveysStore);
             
               
              }else if((result.layerName === 'surveys') && (result.layerName === 'Control Points')){
                showSurveysNameGrid()             
                surveyItems.push(feature.attributes);  
                showPointNameGrid();
                controlItems.push(feature.attributes);  
                
               
                
                
                var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT',items:surveyItems}});
                var grid = dijit.byId('grid5');
               grid.setStore(surveysStore);
              
                
                var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
                var grid = dijit.byId('grid4');
               grid.setStore(controlStore);
              
             
               
               }
                    
                    
                   
               });
               
               
             
    
    		
               
              
            });
    
    
          }
    One approach I would try is to store the identify results in seperate data stores, and then dynamically build/rebuild the datagrid(s) based on users choice (one or both)...

  3. #3
    Emily LaMunyon
    Join Date
    Sep 2010
    Posts
    169
    Points
    6
    Answers Provided
    1


    0

    Default Re: Display Results for 2 Layers?

    Thanks so much for the answer!

    That is what I was trying to accomplish with the code I originally posted.

    Is it possible to get information for two layers using the following code?

    Code:
     }else if((result.layerName === 'surveys') && (result.layerName === 'Control Points')){
                showSurveysNameGrid()             
                surveyItems.push(feature.attributes);  
                showPointNameGrid();
                controlItems.push(feature.attributes);  
                
               
                
                
                var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT',items:surveyItems}});
                var grid = dijit.byId('grid5');
               grid.setStore(surveysStore);
              
                
                var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
                var grid = dijit.byId('grid4');
               grid.setStore(controlStore);
              
             
               
               }
                    
                    
                   
               });

  4. #4
    Heming Zhu

    Join Date
    May 2010
    Posts
    514
    Points
    47
    Answers Provided
    7


    0

    Default Re: Display Results for 2 Layers?

    Quote Originally Posted by elove View Post
    Thanks so much for the answer!

    That is what I was trying to accomplish with the code I originally posted.

    Is it possible to get information for two layers using the following code?

    Code:
     }else if((result.layerName === 'surveys') && (result.layerName === 'Control Points')){
                showSurveysNameGrid()             
                surveyItems.push(feature.attributes);  
                showPointNameGrid();
                controlItems.push(feature.attributes);  
                
               
                
                
                var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT',items:surveyItems}});
                var grid = dijit.byId('grid5');
               grid.setStore(surveysStore);
              
                
                var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
                var grid = dijit.byId('grid4');
               grid.setStore(controlStore);
              
             
               
               }
                    
                    
                   
               });
    Without context, I cannot really tell whether your function would work. It should work.

  5. #5
    Emily LaMunyon
    Join Date
    Sep 2010
    Posts
    169
    Points
    6
    Answers Provided
    1


    0

    Default Re: Display Results for 2 Layers?

    Thanks again for the reply!

    I am trying to set-up a situation where if the user of the map manually selects overlapping features using the Identify task, both results will display in seperate datagrids at the bottom of the screen.

    I have it working if only one layer is selected, results are displayed in the datagrid. I also have it working where if two layers are selected, they highlight as such on the map. I am just stuck on how to show the results of the selection in 2 datagrids at the bottom of the page. I am also open to having a propmt that allows the user to chose which results to show after selecting both layers.

    I hope that makes sense. The part that seems to be broken is where I try and get results for both layers using the && operator. The alert does not even display in the section of code.Below is the relevant code.

    I really appreciate any advice you have!! Sorry to be such a newbie.
    Code:
     //SELECT STUFF
    	 dojo.connect(map, 'onLoad', function(theMap) {
         
          navToolbar.deactivate();
               identifyTask = new esri.tasks.IdentifyTask("http://slcarcgisdev1/SLCOGIS/rest/services/public/Surveyor/MapServer");
               
               identifyParams = new esri.tasks.IdentifyParameters();
               identifyParams.tolerance = 3;
               identifyParams.returnGeometry = true;
               identifyParams.layerIds = [0,2];
               identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
               identifyParams.width  = map.width;
               identifyParams.height = map.height;
           
           
              //initialize the toolbar
              toolBar = new esri.toolbars.Draw(map);
              dojo.connect(toolBar, "onDrawEnd",onDrawEnd);          
              navToolbar.deactivate();
              //resize the map when the browser resizes
              dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
              
              
            });
    
             
             
           
          
          function onDrawEnd(extent){
              navToolbar.deactivate();
              executeIdentifyTask(extent);
          }
          
          
         function executeIdentifyTask(geom) {
            //clear the graphics layer 
            map.graphics.clear();
          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]));
            
            identifyParams.geometry = geom;
            identifyParams.mapExtent = map.extent;
            identifyTask.execute(identifyParams,function(response){
                var controlItems = [];
                var surveyItems = [];
                         
               dojo.forEach(response,function(result){
                   var feature = result.feature;
                    //add selected feature to graphics layer
                    feature.setSymbol(polygonSymbol);
                    feature.setSymbol(markerSymbol);
                    map.graphics.add(feature);
                    
                 if (result.layerName === 'surveys' && result.layerName === 'Control Points'){
                 alert(result.layerName);
                showSurveysNameGrid();
                surveyItems.push(feature.attributes);  
               
               showPointNameGrid();
               controlItems.push(feature.attributes);  
                
               
                
                
                var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT',items:surveyItems}});
                var grid = dijit.byId('grid5');
               grid.setStore(surveysStore);
              
                
                var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
                var grid = dijit.byId('grid4');
               grid.setStore(controlStore);
              
             
               
               }else if(result.layerName === 'Control Points'){
                    	  alert(result.layerName);
                    	showPointNameGrid();
                    	
                    	controlItems.push(feature.attributes);
                       	 searchType = "selControl";
                   
              
    		
    		          //update the data grid 
              
               var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
               var grid = dijit.byId('grid4');
               grid.setStore(controlStore);
                     
                   
             
             }else if(result.layerName === 'surveys'){
                    	
                    	  alert(result.layerName);
                    	
                    	showSurveysNameGrid();
                    	surveyItems.push(feature.attributes);
                        searchType="selSurveys2";
                             
               var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT_N',items:surveyItems}});
                var grid = dijit.byId('grid5');
               grid.setStore(surveysStore);
                
               
            } 
                    
                    
                   
        });
               
               
             
    
    		
               
              
            });
    
    
          }

  6. #6
    Heming Zhu

    Join Date
    May 2010
    Posts
    514
    Points
    47
    Answers Provided
    7


    0

    Default Re: Display Results for 2 Layers?

    Quote Originally Posted by elove View Post
    Thanks again for the reply!

    I am trying to set-up a situation where if the user of the map manually selects overlapping features using the Identify task, both results will display in seperate datagrids at the bottom of the screen.

    I have it working if only one layer is selected, results are displayed in the datagrid. I also have it working where if two layers are selected, they highlight as such on the map. I am just stuck on how to show the results of the selection in 2 datagrids at the bottom of the page. I am also open to having a propmt that allows the user to chose which results to show after selecting both layers.

    I hope that makes sense. The part that seems to be broken is where I try and get results for both layers using the && operator. The alert does not even display in the section of code.Below is the relevant code.

    I really appreciate any advice you have!! Sorry to be such a newbie.
    Code:
     //SELECT STUFF
    	 dojo.connect(map, 'onLoad', function(theMap) {
         
          navToolbar.deactivate();
               identifyTask = new esri.tasks.IdentifyTask("http://slcarcgisdev1/SLCOGIS/rest/services/public/Surveyor/MapServer");
               
               identifyParams = new esri.tasks.IdentifyParameters();
               identifyParams.tolerance = 3;
               identifyParams.returnGeometry = true;
               identifyParams.layerIds = [0,2];
               identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
               identifyParams.width  = map.width;
               identifyParams.height = map.height;
           
           
              //initialize the toolbar
              toolBar = new esri.toolbars.Draw(map);
              dojo.connect(toolBar, "onDrawEnd",onDrawEnd);          
              navToolbar.deactivate();
              //resize the map when the browser resizes
              dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
              
              
            });
    
             
             
           
          
          function onDrawEnd(extent){
              navToolbar.deactivate();
              executeIdentifyTask(extent);
          }
          
          
         function executeIdentifyTask(geom) {
            //clear the graphics layer 
            map.graphics.clear();
          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]));
            
            identifyParams.geometry = geom;
            identifyParams.mapExtent = map.extent;
            identifyTask.execute(identifyParams,function(response){
                var controlItems = [];
                var surveyItems = [];
                         
               dojo.forEach(response,function(result){
                   var feature = result.feature;
                    //add selected feature to graphics layer
                    feature.setSymbol(polygonSymbol);
                    feature.setSymbol(markerSymbol);
                    map.graphics.add(feature);
                    
                 if (result.layerName === 'surveys' && result.layerName === 'Control Points'){
                 alert(result.layerName);
                showSurveysNameGrid();
                surveyItems.push(feature.attributes);  
               
               showPointNameGrid();
               controlItems.push(feature.attributes);  
                
               
                
                
                var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT',items:surveyItems}});
                var grid = dijit.byId('grid5');
               grid.setStore(surveysStore);
              
                
                var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
                var grid = dijit.byId('grid4');
               grid.setStore(controlStore);
              
             
               
               }else if(result.layerName === 'Control Points'){
                    	  alert(result.layerName);
                    	showPointNameGrid();
                    	
                    	controlItems.push(feature.attributes);
                       	 searchType = "selControl";
                   
              
    		
    		          //update the data grid 
              
               var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
               var grid = dijit.byId('grid4');
               grid.setStore(controlStore);
                     
                   
             
             }else if(result.layerName === 'surveys'){
                    	
                    	  alert(result.layerName);
                    	
                    	showSurveysNameGrid();
                    	surveyItems.push(feature.attributes);
                        searchType="selSurveys2";
                             
               var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT_N',items:surveyItems}});
                var grid = dijit.byId('grid5');
               grid.setStore(surveysStore);
                
               
            } 
                    
                    
                   
        });
               
               
             
    
    		
               
              
            });
    
    
          }
    You might want to change you logic flow in your function. Here is the example:
    Code:
    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"){
    	
                	//alert(result.layerName);
    		feature.setSymbol(polygonSymbol);
    		surveyItems.push(feature.attributes);
    	   else{
    		feature.setSymbol(markerSymbol);
    		controlItems.push(feature.attributes);  
    	   }
    	   //add selected feature to graphics layer       
               map.graphics.add(feature);
    	 });
               
             if(surveyItems.length >0){
    		 
                var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT',items:surveyItems}});
                var grid = dijit.byId('grid5');
                grid.setStore(surveysStore);
    	    showSurveysNameGrid();
    	 }
    	 if(controlItems.length >0){
    	    var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
    	    var grid = dijit.byId('grid4');
                grid.setStore(controlStore);
    	    showPointNameGrid();
    	 }           	
        	
         });
    }

  7. #7
    Emily LaMunyon
    Join Date
    Sep 2010
    Posts
    169
    Points
    6
    Answers Provided
    1


    0

    Default Re: Display Results for 2 Layers?

    Thanks so much!!! I got it to work!

    I really appreciate your help with this

  8. #8
    Emily LaMunyon
    Join Date
    Sep 2010
    Posts
    169
    Points
    6
    Answers Provided
    1


    0

    Default Re: Display Results for 2 Layers?

    I thought this was working, and it almost is, when any one feature is selected by dragging a selection box, the results display fine. The problem arises when the selection box selects two overlapping features from different layers. I want results from all selected features to display in their respective data grids, or give the user an option to chose which data grid results to show. Currently, it seems that only the surveys results are displaying, even though the Control Points are being selected as well. Any advice on how to remedy this? Could it be because Control Points are a point layer and they do not have length?

    Thanks for any help!

    Code:
     dojo.connect(map, 'onLoad', function(theMap) {
         
          navToolbar.deactivate();
               identifyTask = new esri.tasks.IdentifyTask("http://slcarcgisdev1/SLCOGIS/rest/services/public/Surveyor/MapServer");
               
               identifyParams = new esri.tasks.IdentifyParameters();
               identifyParams.tolerance = 3;
               identifyParams.returnGeometry = true;
               identifyParams.layerIds = [0,1,2];
               identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
               identifyParams.width  = map.width;
               identifyParams.height = map.height;
           
           
              //initialize the toolbar
              toolBar = new esri.toolbars.Draw(map);
              dojo.connect(toolBar, "onDrawEnd",onDrawEnd);          
              navToolbar.deactivate();
              //resize the map when the browser resizes
              dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
              
              
            });
    
             
             
           
          
          function onDrawEnd(extent){
              navToolbar.deactivate();
              executeIdentifyTask(extent);
          }
          function executeIdentifyTask(geom) {
           navToolbar.deactivate();
            map.graphics.clear();
            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]));
            
            identifyParams.geometry = geom;
            identifyParams.mapExtent = map.extent;
            identifyTask.execute(identifyParams,function(response){
                var controlItems = [];
                var surveyItems = [];
            
                dojo.forEach(response,function(result){
    
               var feature = result.feature;
                    
               if (result.layerName =="surveys"){
    	       showSurveysNameGrid();
                   feature.setSymbol(polygonSymbol);
    	       surveyItems.push(feature.attributes);
    	   }else if (result.layerName=="Control Points"){
    	   	  showPointNameGrid();
    		feature.setSymbol(markerSymbol);
    		controlItems.push(feature.attributes);  
    	   }
    	   //add selected feature to graphics layer       
               map.graphics.add(feature);
    	 });
              
             if(controlItems.length >0){
    	    var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
    	    var grid = dijit.byId('grid4');
            grid.setStore(controlStore);
    	    showPointNameGrid();
    	 }           	
        	 
             if(surveyItems.length >0){
    		 
                var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT_N',items:surveyItems}});
                var grid = dijit.byId('grid5');
                grid.setStore(surveysStore);
    	    showSurveysNameGrid();
    	 }
    	
         });
    }

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts