How To Name Things In ArcGIS

2995
3
05-06-2016 07:51 PM
Labels (1)
curtvprice
MVP Esteemed Contributor
6 3 2,995

The Rules

  1. Avoid spaces or any special characters in pathnames. Including spaces or other special characters in folder names may work, but it is best to avoid them (see 7, below)
  2. Avoid long pathnames. Try to "flatten" your folder structures so that your system pathnames under 128 characters. It is likely you can go higher but not that much: the absolute Windows pathname limit (MAXPATH) is 260 characters. (This actually makes sense  if 256 is the real ancestral limit: 1+2+256+1 or [drive][:\][path][null] = 260)
  3. Never begin an ArcGIS object name (table, field, relationship class, mxd file, folder, etc) with a number or any other non-alpha character. The only recommended non alphanumeric to use is "_". 
  4. Avoid names that may conflict with SQL or other language's reserved words. For example: OBJECTID, VALUE, COUNT, NOT, OR, ON, IN, OVER, SELECT.  This is to avoid confusing both people and SQL.
  5. All field names should contain 10 characters or less. This is a dBase limit, so it applies to .dbf files AND shapefiles. For that reason it's best practice in case you need to go "through" a dbf based format. Coverage and grid names have a limit of 13 characters, but 10 is safer. If you really want a longer name around or one with special characters, use the alias.
  6. If you choose to use names that do not follow these rules, be warned that you may be causing unnecessary trouble when you try to convert the data to a format or run a specific tool down the road. (Probably right before the project is due!)
  7. Raster file names can be particularly problematic. Raster dataset names MUST start with a letter and it is best to keep the filename under 14 characters to support Esri grid format, and special characters in the path (space, &, -) can cause raster exports and tools to fail with cryptic error messages (like 999999).
  8. The arcpy methods ValidateFieldName and ValidateTableName can be used at parameter validation time, or in your code, to prevent users of your tool from inserting invalid output names. The CreateScratchName method if provided the proper arguments, will generate valid dataset names.

You have been warned. Violating these suggestions may work, but one thing I have learned in my long career is that one should avoid tempting fate.

References

Tags (3)
3 Comments
DanPatterson_Retired
MVP Esteemed Contributor

Spaces,

Punctuation,

Always

Create
Errors

curtvprice
MVP Esteemed Contributor

Just had a student lose some stuff because it was in Users\xxx\Documents\ArcGIS which did not get backed up.

I tell them not to do that at the beginning of term but, I really like your catchy phrase "Users is for losers" - they just may remember that!

DanPatterson_Retired
MVP Esteemed Contributor

Sadly, I had a few this term as well... fortunately I didn't have any ... Desktop is for Dummies... to try and recover

About the Author
Lecturer, Geospatial Technology, South Dakota Mines * USGS (ret) * Esri Certified Desktop Professional * https://sites.google.com/sdsmt.edu/cprice
Labels