Hello,
I'm using LayerFactory.Instance.CreateFeatureLayer(...) to create new Layers based on .lyrx files.
The Layer's "dataset" references an existing feature-table in the geo-database.
What I expect: ArcGIS Pro creates the new layer and renders the existing geo-objects from the feature-table.
What happens: ArcGIS Pro creates the new layer, but does not render any objects. The layer is empty. However, when I open the Layer's "attribute table", using the context menu, I can see the data!
Obviously, I'm missing something. Is there a way to enforce the rendering of existing data programmatically?
4 weeks have passed since I posted this question.
In the meantime, we've tried every conceivable way to get this to work, but to no avail...
Seems we have a profound misunderstanding of how layers relate to their database tables.
Some more background:
We have an ArcGIS Pro Addin with a remote interface to a client application. When the addin initializes, it creates the database with the appropriate tables. Afterwards, the client application may start sending "draw requests" to the Addin.
Once the user opens a map view, the Addin reacts by adding the expected feature Layers. However, even though there's already data in the dataset, nothing appears on the Map
This is just a guess, but I'm pretty sure when you bring in a .lyrx file it also brings in any scale references, etc. that were set at the time you created the .lyrx. Do you have anything like that set that would prevent the data from displaying properly?
I use this functionality often and never have seen an issue, so I assume this issue is specific to your layer definition and/or data. In the attribute table you can select a feature and then use the 'zoom to' function to see where that takes you on the map, maybe there's a projection problem. If you add the layer through the UI in Pro it works fine? Is it failing only when you add it through the SDK?
Thank you for your replies!
We've investigated the problem further and found out something interesting:
Our geo-data will be displayed if we do the following two things after creating the FeatureLayer:
Neither operation is sufficient on on its own, you need to do both of them!
So, unsatisfiying as it may be, we'll use this workaround until someon comes up with a better solution...