Unsupported Arc: “Rebox”ing or updating the extent of a feature class.

I’ve found that sometimes I can not find the answer to a question until I know the answer & then it becomes ridiculously easy to find the answer.

One small annoying thing that I never spent much time was when you delete features from a feature class making it significantly smaller but the envelope does not get re-sized so the zoom extent (still the original extent) is too large. This often happens to use when we convert tables to an XY theme and there are blank records–most of our data shows in Minnesota but there are some in Oklahoma (I think). Once we eliminate or correct the blank records, our data view still pops out to include a large section of the United States even though we only have data in Minnesota.

A long, long time ago, Workstation ArcInfo had a simple command, Rebox, for just this purpose (actually it still does, I just don’t get to use it anymore)–it shrunk the extent to the smallest rectangle required to enclose all the data. Up until today, I thought the request for this feature was completely ignored.

While researching something else, I was digging around in the sde tables and found one, sde.sde_layers, that had the interesting fields, minx, miny, maxx, and maxy. My quick & dangerous test (I performed it on a throw-away feature class in a throw-away geodatabase) gave me the results I wanted–once I loaded the feature class into ArcMap, the extent was a nice, tight rectangle around my features.

Is this a supported way to Rebox the extent? No.

Is it recommend by ESRI or me? No.

Will it screw up your entire geodatabase, making you lose all your data & costing you your job? Probably not but do you want to take that chance?

Will it get the job done? Maybe.  But in the process of writing this post, I found two safer ways to go about it. First, the straight-forward, sde command-line way that probably always existed that I never found until today, sdelayer -o alter had an -E option to reset the extent, including the ability to either specify it or have sde calculate it. Ok, that is usable for one person in our organization.

Previously, we had found either a VBA or other tool for doing this but had minimal success with it. Today, I found an ArcGIS 10 Add-In that is suppose to do the same thing. In my experiments (sample size n=1) it worked perfectly. If you need this sort of functionality, I would recommend trying out this Add-In first, if that fails go the sde command line route. Use the direct SQL method at your own risk!


2 thoughts on “Unsupported Arc: “Rebox”ing or updating the extent of a feature class.

  1. I achieved the resetting of the extent with the following VB code which is executed by an on click event of a button in ArcCatalog:

    Dim pGXApplication As IGxApplication
    pGXApplication = My.ArcCatalog.ThisApplication
    Dim pGxObject As IGxObject
    pGxObject = pGXApplication.SelectedObject
    If Not TypeOf pGxObject.InternalObjectName Is IFeatureClassName Then
    Exit Sub
    End If
    Dim pName As IName
    pName = pGxObject.InternalObjectName

    ‘ Get Extent of dataset
    Dim pGeoDataset As IGeoDataset
    pGeoDataset = pName.Open
    Dim pEnvelope As IEnvelope
    pEnvelope = pGeoDataset.Extent
    Dim pArea As IArea
    pArea = pEnvelope
    Dim d As Double
    d = pArea.Area

    Dim pFeatureClassManage As IFeatureClassManage
    If pGxObject.Category = “Shapefile” Then
    pFeatureClassManage = pName.Open
    Dim pSchemaLock As ISchemaLock
    pSchemaLock = pName.Open
    pFeatureClassManage = pSchemaLock
    End If
    pGeoDataset = pName.Open
    pEnvelope = pGeoDataset.Extent
    pArea = pEnvelope
    Dim d2 As Double
    d2 = pArea.Area

    MsgBox(“The area for ” & pGxObject.Name.ToString & vbCr & “was ” + d.ToString & vbCr & “and is now ” & d2.ToString, MsgBoxStyle.Information, “Successfully updated spatial extent”)
    Catch ex As System.Exception
    End Try

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s