What is the use case for Popup and friends and how do they relate to Callout and Feature.attributes?

747
2
Jump to solution
08-08-2021 08:23 PM
DaveWhitla
New Contributor III

I'm struggling to understand the value of Popup and how you use PopupDefinition with a FeatureLayer or FeatureTable to customise the display of feature attributes on mouse events.

What does PopupDefinition do that isn't covered by Feature.attributes?

The problem I am trying to solve is displaying feature cards in response to mouse-over or mouse-click events in the map view.

In other frameworks I have subclassed or decorated the equivalent of Feature to retain a reference to the view model for the feature being displayed, which I then get back in hit detection (identify) results and I then ask the feature or its factory to return an instance of its callout view.

So far in arcgis-runtime-sdk-java I have tried populating the non-extensible Feature's attribute map and retrieving these attribute values from the GeoElements returned in IdentifyLayerResults. This though requires hard-coding specifics about what FeatureTables contain what types of application features in multiple places and relying on string-bashing to marshal values in and out of attribute maps, rather than simply initialising the callout views with the domain types they represent. This all yields code that couples my code to internal details of ArcGIS, global constants littering the codebase and Map<String,Object> data representations that fight type-safety and will be a PITA to maintain. 

When I discovered the existence of PopupDefinitions and that these could be defined per layer/table I thought I could use them to address at least a couple of these issues, defining the callout card implementation selection at the point the layers are created, but on trying to actually use them it looks no different to setting the attributes on the feature.

How do the authors see these thing actually being used? There is little in the way of descriptive documentation on Popup and only a very simple HelloWorld-level example of Callout presentation.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
MarkBaird
Esri Regular Contributor

I don't know a lot about your application, but I'm wondering where your data comes from in your map?  I sounds like your data is coming from a Feature service, but how is this added to your map?  Are you adding the feature services by building up your operational layers (programatically), or are you using a pre-authored map from ArcGIS Online (WebMap)?

 

If you are using a map (a webmap) from ArcGIS Online there is a way of authoring your webmap so when you look at on a client app (JavaScript, Runtime etc) and display the data, only a defined subset of the feature attributes are displayed.  This definition of the attributes you want your user to see is called a popup definition.

 

So when you perform an identify operation on your MapView, you have to choice to either work with the complete set of attributes from the feature, or the authored subset which will be in the popup.

Does this help?

View solution in original post

0 Kudos
2 Replies
MarkBaird
Esri Regular Contributor

I don't know a lot about your application, but I'm wondering where your data comes from in your map?  I sounds like your data is coming from a Feature service, but how is this added to your map?  Are you adding the feature services by building up your operational layers (programatically), or are you using a pre-authored map from ArcGIS Online (WebMap)?

 

If you are using a map (a webmap) from ArcGIS Online there is a way of authoring your webmap so when you look at on a client app (JavaScript, Runtime etc) and display the data, only a defined subset of the feature attributes are displayed.  This definition of the attributes you want your user to see is called a popup definition.

 

So when you perform an identify operation on your MapView, you have to choice to either work with the complete set of attributes from the feature, or the authored subset which will be in the popup.

Does this help?

0 Kudos
DaveWhitla
New Contributor III

Thanks Mark, I think this answers my question.

It seems PopupDefinition was designed to address a specific use case (the one you described above) that is very different to my scenario. I have no need to filter attributes or transform their values for presentation as I am programmatically constructing the features and set only the attributes I want to display or use for rendering control.

While it doesn't address my needs it is good to at least understand its purpose. 

0 Kudos