|     Documentation    |     Premium Support

Layer Renaming Issue


See attached sample. I am trying to rename a layer and even though the layer is renamed, if I try to subsequently add a new layer with the previously renamed name, I get an error that the item already exists.

Notice that I do a listing of all the layer names in the overlay after the rename has been done and the original name does not exist…

In my main project, I also noted that if I rename the layer, serialize the data and then reload it, I can use the original name again. Maybe something in the overlay memory that is not being refreshed. (235.7 KB)


Thanks Damian,
That because the key of the layer not get changed with the layer name. You can remove the layer and add it again.

… .

            InMemoryFeatureLayer imflB = new InMemoryFeatureLayer();
            imflB.Name = "B1Buff";
            imflB.InternalFeatures.Add(new Feature(B1Buff));
            lo.Layers.Add("B1Buff", imflB);

            // Rename buffered layer
            Layer f = lo.Layers["B1Buff"];
            f.Name = "B1BuffRN";

            // Look at all the layer names to make sure the name was updated
            foreach (var layer in lo.Layers)




Hi Frank,

Okay, I’ve done it that way and it works

Still seems like not being able to rename an object without deleting it is a bug.


Thanks Damian,
Yes. This seems a workaround. I have posted this to the internal issue board. We may able to change the key as the same time we change the layer name. This could release with next major release.