Add multiple layers to map pointing to same table

01-09-2018 04:19 PM
MVP Regular Contributor

In our offline maps the users require that they be able to view a specific linear features in multiple ways.  This is a pretty standard need within our industry.  These layers also happen to be quite large ~600 Mb.  The hope was that we could have a single replica of this data and render it multiple ways in the offline map.  Identical to how you would do in ArcMap or ArcGIS Pro by adding a layer from the same table symbolized differently.

I was able to write a tool and uses different services to generate the renderers serialized into json, which I thought was going to be the hurdle to overcome.  Using these files it is possible to create a feature layer and use the json to create the renderer as hoped.  Unfortunately, from what I see this approach is not possible.  It would seem that for some reason a GeodatabaseFeatureTable can only be used as the source for a single FeatureLayer.  When the application tries to create the second FeatureLayer the following error occurs:

Esri.ArcGISRuntime.ArcGISRuntimeException: Object already owned.: Already owned.
at Esri.ArcGISRuntime.ArcGISException.HandleCoreError(CoreError error, Boolean throwException)
at RuntimeCoreNet.GeneratedWrappers.Interop.CheckError(IntPtr errorHandle, Boolean throwOnFailure, GCHandle wrapperHandle)
at RuntimeCoreNet.GeneratedWrappers.CoreFeatureLayer..ctor(CoreFeatureTable featureTable)
at Esri.ArcGISRuntime.Mapping.FeatureLayer..ctor(FeatureTable featureTable)

Why?  What is the reasoning behind only allowing a GeodatabaseFeatureTable to be 'owned' by a single FeatureLayer?  Is there something else I am possibly doing that would cause this error or is this idea something that is not possible?  The ability to apply different renders and/or definition expressions to the same GeodatabaseFeatureTable would allow us to greatly reduce the footprint of offline replicas and reduce the amount of data syncronization required so it would be a great solution.



0 Replies