Finding out if a File Geodatabase Feature Class is compressed

Compressed file geodatabases (fGDB) are a great thing. They render data amazingly fast and search quickly but take up a miniscule amount of disk space. Good job to ESRI on getting it right.

They are not editable though, and therefore need to be removed from any candidate editable feature classes you may be looking at.

The following piece of code can be used to determine if the ftrClass is editable:

ICompressionInfo info = featureClass.FullName as ICompressionInfo;
if (info != null)
{
    if (info.IsCompressed == true)
        return true;
}
This also handles when you are dealing with a feature class that is not from a fGDB as it will not implement ICompressionInfo.
 

Filebased Geodatabase Date Filtering

So I had to add some functionality to filter by date and normally this is really simple in ArcObjects as you use the IQueryFilter::WhereClause and enter a date formatted where clause in there.

One problem though. I am using Filebased Geodatabase and I did not know what the correct way to encode the date is! I thought about it for a little while and then decided to use the trusty Query Builder from within ArcMap. It worked a charm.

image

It is hard to see but they encode the date by pre-pending ‘date ‘ and encoding the actual date in ‘yyyy-mm-dd’ format.

Must archive this somewhere in my brain where it will not get lost!