5

I'm using ArcMap 10.2, I'd like to restrict the type of records that makes their way into a feature class to only those with a geometry. Is there a way to create feature class in a geodatabase where the SHAPE field is set to non-nullable?

Ie. "Allow NULL Values" changed to "No"?

enter image description here

  • Is the table or feature class is registered as versioned? – whyzar Jun 1 '17 at 14:17
  • @whyzar No I don't think so. I just tried with a blank FGDB and then from there I created a new feature class. – GIS_Newbie Jun 2 '17 at 3:08
6

Yes and No. As @whyzar has answered, you can change the Allow NULL values property on the SHAPE field.

However, this will not stop features being added without geometry!

To emphasise the point at the end of @whyzar's answer, ArcGIS does not use this property to force a user to populate the field. All this property does is not record NULL in a field, so if the user doesn't enter anything it will record

empty value (numeric = 0, text = "") instead of a database NULL

There is no notification telling the user to enter something, or not allowing them to save if they haven't.

To demonstrate, I have created two feature classes - one with Allow Nulls = Yes, and the other with Allow Nulls = No.

Screenshot of Allow Nulls = No

enter image description here

I drew in two new lines, and then added two records into the attribute table without creating lines. I was able to do this, including save/stop edits, in both feature classes without any message or warning.

enter image description here

  • Interesting. I think I have to validate the geometry using other criteria such as the shape length? – GIS_Newbie Jun 1 '17 at 16:23
  • You could potentially have a process which checks features every day to find any without a geometry and then report them to you. There might be third-party tools that enforce rules like this, but I'm not aware of any specifically. – Midavalo Jun 1 '17 at 16:25
2

Yes, you should be able to do so when using a file geodatabase and then creating a new feature class. Unless the feature class is registered or versioned.

enter image description here

Esri allow provided this Allow Nulls:

Allow or disallow NULL values If the table or feature class is registered as versioned and its adds table contains data, you cannot change the Allow NULL values property from Yes to No.

and this Fields and field properties

Allow Nulls: This controls whether the field will have a NOT NULL constraint on it when the field is created. If Allow Null Values is set to No, the field definition in the database will contain the NOT NULL constraint. If, on the other hand, you stay with the default of Yes, the field will be NULLABLE.

Note: The geodatabase model is such that it will insert an empty value (numeric = 0, text = "") instead of a database NULL if, and only if, the field in the database has a NOT NULL constraint on it.

  • I couldn't get that drop-down menu to show up like you did - Not even when I experimented with a blank FGDB and creating a new feature class from there. – GIS_Newbie Jun 1 '17 at 16:16
  • @GIS_Newbie Did you try while creating the feature class (aka in the tool) or after creation? – mkennedy Jun 1 '17 at 20:29
  • @mkennedy Neither case worked for me.. – GIS_Newbie Jun 2 '17 at 3:07
  • @GIS_Newbie For my answer I did it the same way - when creating the feature class, on the fields tab I just clicked on the box next to "Allow NULL values" and the drop-down appeared, so I selected No. – Midavalo Jun 2 '17 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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