Add field to virtual layer (make feature layer) changes the original feature layer

1622
2
07-14-2011 07:02 AM
EdApalinski
Occasional Contributor
Trying to add a field to a virtual layer created using the make feature layer tool, the add field tool adds the field to the original feature layer as well as the virtual layer. The online help states the add field can be used on a layer file. I have set the workspace and scratch workspace to a different environment, the tool continues to write to the original feature layer. The eventual users of the script/model will not have write access to the original features, so the tool fails since it can not write to the original table.
Thanks in advance for any help you can provide.
0 Kudos
2 Replies
ChrisSnyder
Regular Contributor III
A feature layer (what you are calling a virtual layer I think) is nothing more than a pointer to a feature class on disk. As a best practice, always add the field(s) to the feature class 1st, then make a feature layer from the feature class.

The eventual users of the script/model will not have write access to the original features, so the tool fails since it can not write to the original table.


What you probably want to do in this case is copy the original feature classes to a new workspace where the users will have write access. A very good option (if the datasets aren't too big) is the in_memory workspace: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002w0000005s000000.htm
0 Kudos
EdApalinski
Occasional Contributor
Thanks for the info, the geoprocessing script I am building iterates a user entered point through an identity of 20+ polygon layers. I am trying to avoid copying the layers out every time the script runs and I can not add the field to the original layers. Add field then calculate field added the name of each identity layer to append to a results table (copy rows). The odd thing is this worked in a model I built with only one difference, the model included a select by location after the make feature layer and prior to the add field. I might give the in-memory a shot.
Thanks again.
0 Kudos