I have an inmemoryfeaturelayer that contains multiple points/lines/polygons. How can I choose which features are shown on top? I tried changing the index of various features then refreshing the overlaying, but that didn’t change anything.
Thanks.
I have an inmemoryfeaturelayer that contains multiple points/lines/polygons. How can I choose which features are shown on top? I tried changing the index of various features then refreshing the overlaying, but that didn’t change anything.
Thanks.
Hi Dan,
I think that’s should related with the added order. So you can create another inmemoryfeaturelayer and add the feature into it by your order.
Please let us know whether it’s helpful.
Regards,
Ethan
Hmm, doesn’t seem to be working. I created a new inmemoryfeaturelayer, added the features from the old layer in the order that I want, and then set the old layer equal to the new, and refreshed the overlay it’s in. But nothing displayed on the map, although I can confirm the features are in the InternalFeatures collection of the new layer.
Here’s what I’m doing:
InMemoryFeatureLayer featureLayer = new InMemoryFeatureLayer();
GeoCollection<Feature> tempCollection = (userFeaturesOverlay.Layers[0] as InMemoryFeatureLayer).InternalFeatures; //the first layer in userFeaturesOverlay is the layer I want to change the drawing order of the features in
tempCollection.MoveTo(1, 0); //just a test, move the last feature drawn to the front
foreach (Feature feature in tempCollection)
{
featureLayer.InternalFeatures.Add(feature); //add the features into the new layer in a new order
}
featureLayer.Name = userFeaturesOverlay.Layers[0].Name;
userFeaturesOverlay.Layers[0] = featureLayer; //set old layer equal to the new
Map.Refresh(userFeaturesOverlay); //refresh the overlay
Edit: Got it working. Had to set the styles/zoom levels of the new layer to the same as the old.
Thanks!
Hi Dan,
Thanks for your update.
I am glad to hear that works.
Regards,
Ethan