Hi,
The requirement of the App is when user tap on the location, it will display a popup with all the visible and related feature layer information. How can I do it?
// MARK: - AGSGeoViewTouchDelegate
func geoView(_ geoView: AGSGeoView, didTapAtScreenPoint screenPoint: CGPoint, mapPoint: AGSPoint) {
// Identify graphics at the tapped location.
mapView.identifyLayers(atScreenPoint: screenPoint,
tolerance: 10,
returnPopupsOnly: false,
maximumResultsPerLayer: 20
) { [weak self] (results, error) in
//check for errors and ensure identifyLayerResults is not nil
if let error = error {
print(error)
return
}
guard let identifyLayerResults = results,
let self = self else { return }
var resultCount:Int = 0
print("identifyLayerResults.count = \(identifyLayerResults.count)")
// Loop through all results and get the count for those.
for identifyLayerResult in identifyLayerResults {
resultCount += self.getIdentifyLayerResultCount(identifyLayerResult)
}
if resultCount > 0 {
//Want to add code here to display the result in the popups with more than one from feature layers
}
print("result count = \(resultCount)")
}
}
func getIdentifyLayerResultCount(_ identifyLayerResult: AGSIdentifyLayerResult) -> Int {
var resultCount: Int = 0
resultCount += identifyLayerResult.geoElements.count
//process the sublayer results for each layer (e.g. for map image layers)
print("identifyLayerResult.sublayerResults.count = \(identifyLayerResult.sublayerResults.count)")
// Loop through each subLayerResult recursively and get their count.
for subLayerResult in identifyLayerResult.sublayerResults {
resultCount += getIdentifyLayerResultCount(subLayerResult)
}
return resultCount
}