Using a ListModel as a model for map markers

1109
4
Jump to solution
06-29-2021 08:36 AM
KennSebesta
New Contributor III

I might have missed this in the examples, but I cannot find a worked example of how to have points/markers/symbols be linked to a ListModel.

I have an XMLListModel from NOAA which lists all the weather stations across the US and I would like to plot their location with a simple circle. This is pretty simple so I'm sure it's low-hanging fruit for the right approach. It seems that I could create each point through iteratively  calling `ArcGISRuntimeEnvironment.createObject()`, but this doesn't feel "qml-like". I'm hoping to find a view which consumes the model, much like the QML-native MapItemView.

Nothing in the API jumps out at me as appropriate, with the closest being GeoView. However, a GeoView cannot be created directly and is inherited by a MapView and a SceneView, neither of which is appropriate for a model view which consumes a ListModel.

This forum post seems to be asking for the same thing, but it's 6 years old so perhaps the feature has been implemented in the meanwhile.

Questions:

  • Is there SDK support for an ArcGIS equivalent of the MapItemView?
  • If not, what is the recommended way to create the same behavior?
0 Kudos
1 Solution

Accepted Solutions
JamesBallard1
Esri Regular Contributor

@KennSebesta , no, it's not possible I'm afraid. You'd need to read the data out and parse it manually.

We do allow nesting of objects (Map nested in a MapView, Graphics nested in a GraphicsOverlay), but they all need to be Runtime objects and declared to utilize that workflow.

On the plus side, it should not be very difficult to parse out the data and create the graphics from any long/lat data in the file. The example I shared is doing exactly that.

View solution in original post

0 Kudos
4 Replies
JamesBallard1
Esri Regular Contributor

Hi @KennSebesta ,

Unfortunately there is no way to apply an XmlListModel of data to our MapView. We do support MVC with our creatable view types being MapView (2D) and SceneView (3D) along with their models, Map and Scene.

There is no way to "hydrate" graphics onto our Map or Scene directly from an XmlListModel. We do have an existing sample showing how to get graphics onto the map from data in an xml file, via an XmlListModel.

https://github.com/Esri/arcgis-runtime-samples-qt/blob/main/ArcGISRuntimeSDKQt_QMLSamples/DisplayInf...

If the incoming data is from an open standard like OGC, the Runtime can natively support OGC.

0 Kudos
KennSebesta
New Contributor III

Gotcha.

I might have erred in mentioning that I'm using an XMLListModel, since the question is about the broader ListModel component. Is there an example about how to "hydrate" graphical markers onto a Map, with the markers coordinates being defined in a standard ListModel? 

0 Kudos
JamesBallard1
Esri Regular Contributor

@KennSebesta , no, it's not possible I'm afraid. You'd need to read the data out and parse it manually.

We do allow nesting of objects (Map nested in a MapView, Graphics nested in a GraphicsOverlay), but they all need to be Runtime objects and declared to utilize that workflow.

On the plus side, it should not be very difficult to parse out the data and create the graphics from any long/lat data in the file. The example I shared is doing exactly that.

0 Kudos
KennSebesta
New Contributor III

Understood.

If you guys get a chance, it would be nice to have support for this feature. The MapItemView interface is very clean to read/write, and it's furthermore easy to use when removing items. Looking at the above GODictionaryRenderer example, it seems like there's a non-trivial burden to finding an item once it's appended to the generic graphicsOverlay.

0 Kudos