Element Recognition
Element Recognition is the identify in ArcGIS. The difference between it and the preceding query is that it can perform space Filtering for multiple layers and specify a certain degree of tolerance. The feature of Element Recognition is used in the "highlightfeatures" example of ArcGIS Android API. Let's first run this example:
Figure 28 Map Service Element Recognition
The implementation of this function is very similar to that of querytask, but the called object is identifytask. Let's take a brief look at the implementation of the Code:
Identifyparameters inputparameters =NewIdentifyparameters ();
Inputparameters. setgeometry (pointclicked );
Inputparameters. seturl ("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services
/PublicSafety/publicsafetybasemap/mapserver/identify ");
Inputparameters. setlayers (New Int[] {Layerindexes [selectedlayerindex]});
Inputparameters. setmapextent (mapview. getextent ());
Inputparameters. setdpi (96 );
Inputparameters. setmapheight (mapview. getheight ());
Inputparameters. setmapwidth (mapview. getwidth ());
Inputparameters. settolerance (10 );
FinalIdentifytask identifyaction =NewIdentifytask (inputparameters );
Identifyresult [] Results = identifyaction.exe cute ();
From the code, we can see that the use of the identify function is almost the same as that of all other ArcGIS Server APIs, just like meeting an old friend. The most important parameter to be specified for identify is the included layers and tolerances, which are implemented using the setlayers and settolerance methods respectively. In this way, the ArcGIS Android API knows that the geometric objects to be queried need to be buffered according to the tolerances, and then perform spatial queries in the preceding layers. Finally, the results are summarized and returned to the client.