I'm attempting to create an overview map of my main map, which is populated with FeatureLayers from a Geopackage. According to the documentation to use a single FeatureLayer on multiple maps the layer should be cloned, and the clone used on the secondary Map. When using Geopackage layers this doesn't appear to work. The cloned layer is returned in a "NotLoaded" LoadStatus.
GeoPackage geoPackage = await GeoPackage.OpenAsync(geoPackagePath);
FeatureTable geoPackageTable = geoPackage.GeoPackageFeatureTables.FirstOrDefault();
if (geoPackageTable == null) { return; }
FeatureLayer newLayer = new FeatureLayer(geoPackageTable);
await newLayer.LoadAsync();FeatureLayer cloneLayer = (FeatureLayer)newLayer.Clone();
SourceMap.OperationalLayers.Add(newLayer);
CloneMap.OperationalLayers.Add(cloneLayer);
Thus null values are returned for many of the FeatureLayer properties, such as the Renderer or FullExtent. This also means that the Layer itself is not visible on the map.
To load the layer we would call LoadAsync(), but doing so on the cloned layer, creates the following error:
Is this a bug, or is there something I am missing about cloning Geopackage FeatureLayers?
Solved! Go to Solution.
The on-disk feature tables acts slightly different and I don't believe a clone would really work, as the underlying datasource/featuretable would still be the same.
Instead I think you'd need to open a second instance of the geopackage instead - that should give you a better clone of the feature table.
The on-disk feature tables acts slightly different and I don't believe a clone would really work, as the underlying datasource/featuretable would still be the same.
Instead I think you'd need to open a second instance of the geopackage instead - that should give you a better clone of the feature table.
Thanks Morten!
How did you resolve this issue?
I am having the same problem.
Cheers