AnsweredAssumed Answered

How to zooming or extent to a particular feature?

Question asked by dasnobel on Jul 13, 2017
Latest reply on Jul 13, 2017 by MDostal-esristaff

Hi,

Below is the code which I am using to select feature but the problem is that it is not zooming or extent to that feature. How can I achieve this thing?

 

let queryParams = AGSQueryParameters()

        

        queryParams.whereClause = "Name = '60 EAST BROADWAY, NEW YORK, NY ,10002'"

 

        self.featureTable.queryFeatures(with: queryParams, completion: { [weak self] (result:AGSFeatureQueryResult?, error:Error?) -> Void in

            

            if let error = error {

                

                print(error.localizedDescription)

                       

            }

                

            else if let features = result?.featureEnumerator().allObjects {

                

                if features.count > 0 {

                    

                    self?.featureLayer.select(features)

                    

                    //zoom to the selected feature

                    

                    self?.mapView.setViewpointCenter(features[0].geometry! as! AGSPoint, completion: nil)

                 

                }

                    

                else {

                    

                   // SVProgressHUD.showError(withStatus: "No state by that name", maskType: .gradient)

                    

                }

                

 

            }

            

        })

 

Right now I am using arcgis runtime ios sdk 100.0

 

Thanks,

Kamal

Outcomes