I'm a beginner and i want to know the difference between a layer file and a feature class, and in what context you think a layer file would be useful or when it would be more practical to use a feature class. Thanks!

6324
4
09-17-2018 09:01 AM
DJATEKLOBA
New Contributor

I'm a beginner and i want to know  the difference between a layer file and a feature class, and in what context you think a layer file would be useful or when it would be more practical to use a feature class.

Thanks!

best!

0 Kudos
4 Replies
JoeBorgione
MVP Emeritus

Within the context of ArGIS, there are two basic data formats; Feature Class and Table.  If you need to interact with either of them with arcpy, you would do so first by using:

arcpy.MakeFeatureLayer_management  or

arcpy.MakeTableView_management  respectively

If you are interacting with these to data types in a stand a lone python script you need to use the above mentioned arcpy functions.  There are times when in ArcMap or ArcCatalog that you can get away without explicitly creating a feature layer.  I try to use both functions no matter where I'm using them.

Take a look here: https://community.esri.com/thread/201367-adding-to-a-selection  it's a post I made about a year ago that delves into the concept of feature layers.

That should just about do it....
0 Kudos
DanaNolan
Occasional Contributor III

A feature class is a table with geometry; it is pure data. A lyr file, or a layer inside a map, is just a pointer to data, usually one feature class (but there are group layers). Layers can be saved and shared to save time in building maps or repointing maps to data (feature classes) when the data has moved, and to enforce consistency and quality. A layer can store every property that can be accessed from the Properties dialog in ArcMap, including fields shown, field aliases, symbology, labeling rules, default display field, time handling rules, field order, popups, and selections.

A feature class may be updated; this will automatically be reflected in maps and lyr files accessed after the update. But if the lyr or mxd needs to change, e.g. because the data's fields and location have changed enough that the layer won't draw, users will have to bring in an updated, corrected layer (or try to fix it themselves). When you first add a lyr to your map, you took a snapshot in time; the map will not know if a layer's properties need to be updated...you may see a red exclamation point or get a drawing error.

In my shop, we tell everyone to add data from lyr files because it keeps everyone looking at the best data. I maintain a library of about 150 lyr files.

TimOrmsby
Esri Regular Contributor

Also, look up the definitions for feature class and layer in the Esri Support GIS Dictionary. The basic difference, as Dana indicated, is that the feature class is the data itself and the layer is a representation of the data in a map, with specific symbology, labels, etc. The layer defines how you want the data to look. One and the same feature class can be represented by different layers in different maps (or by different layers in the same map).  A layer file (.lyr or .lyrx) saves the properties of a layer to disk so they can be reused easily. Suppose you spent an hour in ArcMap or ArcGIS Pro defining the properties of a layer in a very exact way--the symbology you want, the labels you want, and all the other settings you can make for a layer. If you're only going to use that exact set of properties once, you don't need a layer file. If you want to reuse them--like if you're establishing a standard cartographic look for your organization--then the layer file is like a template: whenever you add it to a map, all the layer properties are automatically set. Note that the layer file still requires that the feature class it represents be available. Don't make a layer file and then delete the feature class!

ElizabethWheeler
New Contributor III

Tim,

As the lyr points to the data, does that mean changes to the feature class would be reflected in the lyr or would a new lyr need to be generated?

0 Kudos