AnsweredAssumed Answered

How to optimize polygon feature selection?

Question asked by john_moore_3 on May 30, 2019
Latest reply on Jun 3, 2019 by john_moore_3

Is there anyway to optimize the following feature selection code?  Currently, there's about a second delay between when the user taps the screen in the iPad simulator and when the polygon feature is highlighted after being selected.  I can't give an exact count, but there are a LOT of polygons in the "Polygons Layer" feature layer.  Thanks for any help!


func handleSelectionByTapAtScreenPoint(screenPoint: CGPoint) {

      // Select the feature in the Polygons Layer that was tapped.

      let layers = as? [AGSLayer]

      for layer in layers! {

            if let featureLayer = layer as? AGSFeatureLayer, == "Polygons Layer" {

                  self.mapView.identifyLayer(featureLayer, screenPoint: screenPoint, tolerance: 1, returnPopupsOnly: false, maximumResults: 5) { (identifyLayerResult: AGSIdentifyLayerResult) in


                        for geoElement in identifyLayerResult.geoElements {

                              if let feature = geoElement as? AGSFeature {

                                    // Select the feature