Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How does one add a field to an Arcgis feature class with a boolean data type? That is an attribute where the allowed value is only one of a pair such as 1/0, Yes/No, On/Off, Present/Not-present, etc.

A boolean data type is not available in the Data Type pick-list.

share|improve this question
    
I would just make a short integer with a length of 1 and then just only have things be 0/1 in it. –  Emily Apr 23 '12 at 19:49
1  
The goal is be able to restrict values, e.g. can only have 1 or 0, any other is not possible. A short int with length of 1 allows any of 0 thru 9. When a feature class is edited by many people it's hard to ensure they all know what to use. –  matt wilkie Apr 23 '12 at 20:02
    
hmm.. is it possible to restrict a field I guess is really the question.. –  Emily Apr 23 '12 at 20:04
7  
help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//… use attribute domains to restrict field values.. i think this is what you mean –  Emily Apr 23 '12 at 20:06

1 Answer 1

up vote 6 down vote accepted

Many DBMSes including Oracle do not have a Boolean column type, so this may explain why there is no Boolean field type in ArcGIS either.

@Emily's suggestion of using a coded value attribute domain is a good one and I believe this is the ESRI-recommended best practice.

The only other suggestion I would have is to use a CHAR field of length 1, as this way you can use the slightly more descriptive "Y" or "N", or "T" or "F", rather than 1's or 0's, and, according to this article, in Oracle 1-character CHAR columns are actually more efficient than 1-digit NUMBER columns.

share|improve this answer
3  
By using a coded-value domain, you also take advantage of providing the user with more descriptive text than just the character that you will store. From website- "When you add a new value to a domain's coded value list, you must also add a more user-friendly description. When you edit an attribute value for a field that has this domain, the user-friendly values appear in the ArcMap Editor. Descriptions help you select the right value." –  RyanDalton Apr 23 '12 at 20:51
    
Using the attribute domain will restrict user input to what you define ahead of time (in a handy pull-down menu). If you ever need to access it in code, you don't have to account for Y vs. Yes vs. yes vs. y. –  Roy Apr 24 '12 at 12:11
    
I didn't know Oracle doesn't have a native boolean type. I guess I figured that since Access has had this as long as I can remember, and python and other scripting languages have it built in, it must be an industry standard. I'm aware of coded value domains, at least peripherally, but avoided it because it seems so heavy duty for a simple task (Interactively: 11 steps to create a coded-value domain, then another 9 to assign it to a field; Geoprocessing? Use 3 different tools: Create Domain, Add Coded Values to Domain, Assign Domain to Field). –  matt wilkie Apr 25 '12 at 19:41
    
@mattwilkie It gets worse when you start involving subtypes. Also, Oracle is the only of the "Big 4" relational databases (my name for SQL Server, PostgreSQL, MySQL, Oracle not a common name) that doesn't have a type that can be used directly as a boolean. It may, however, be fair to note that SQL Server and MySQL only have a BIT type (which is limited to 0 or 1, rather than an actual true or false value), leaving PostgreSQL as the only of the "Big 4" that has an actual boolean type. –  jpmc26 Mar 13 at 1:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.