Ensure that automatically generated layer names and ids don't cause conf...

...licts

This is in response to Issue #1744, the new behaviour is to append a number, starting with 2, to the auto-generated name if a layer with that name already exists.