I'm currently working on presenting detail information on instances of AGSFeature of a Web Map and am having difficulties presenting the data similar to the Map Viewer of the portal or the ESRI Explorer app.
The feature data has field aliases for certain fields and it is defined to show only some of the properties. When I click on the Web Map in the portal I get a callout with customized field aliases and only those fields defined to show are being presented. Same in ESRI Explorer app.
When I try to present the data in my own app the customized aliases of the fields are not showing up (they're the same as field.name).
Eg. simplified data:
[
{ name: "PROP_A", alias: "beautiful title", visible: true, value: "some value" },
{ name: "PROP_B", alias: "PROP_B", visible: false, value: "some other value" }
]
In Map Viewer / ESRI Explorer the callout says: "beautiful title": "some value".
When I load an AGSPopup it says: "PROP_A": "some value", "PROP_B": "some other value".
First I get the features:
func geoView(_ geoView: AGSGeoView, didTapAtScreenPoint screenPoint: CGPoint, mapPoint: AGSPoint) {
arcgisMapView.identifyLayers(atScreenPoint: point, tolerance: 12, returnPopupsOnly: false, maximumResultsPerLayer: 10) { (results: [AGSIdentifyLayerResult]?, error: Error?) in {
var features = [AGSArcGISFeature]()
results?.forEach { result in
if let theFeatures = result.geoElements as? [AGSArcGISFeature] {
features.append(contentsOf: theFeatures)
}
if !result.sublayerResults.isEmpty {
result.sublayerResults.forEach { subResult in
if let subFeatures = subResult.geoElements as? [AGSArcGISFeature] {
features.append(contentsOf: subFeatures)
}
}
}
}
I'm wondering why result never has any popups populated. But never mind I create the popups myself:
// either simple
let popup = AGSPopup(geoElement: feature)
// alternatively with popupdefinition:
let popupDefinition = AGSPopupDefinition(geoElement: feature)
// or
let popupDefinition = AGSPopupDefinition(popupSource: feature.featureTable)
let popup = AGSPopup(geoElement: feature, popupDefinition: popupDefinition)
let popupsVC = AGSPopupsViewController(popups: [popup], containerStyle: .navigationController)
When I present the popupsVC all fields are shown and no field alias is being used. Why is that? I also tried loading the feature before creating the popup, but no difference.
ESRI Explorer App / Map Viewer show the data perfectly (only the fields that shall be visible with a "beautiful" alias)... Any hints?