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.

I have a featureclass in an Esri file geodatabase. When I edit the features using the editor in ArcMap, and I delete most of my features and keeping only the ones in the middle, the zoom to layer command doesn't work as expected. Instead of zooming to the extent of the features remaining in the feature class, the extent will be the former one (containing all deleted features). When reviewing the extent values in the properties dialog for the feature class, I can clearly see the old values. So the edit session doesn't seem to alter the full extent values.

Is there a way to recalculate these values?

I am pretty sure that this problem should occur to everyone editing features in ArcMap...

share|improve this question
1  
Unfortunately Arc: REBOX did not get translated to as an ArcGIS tool :-) –  PolyGeo May 3 '12 at 2:25
add comment

5 Answers 5

up vote 3 down vote accepted

Compacting the Geodatabase will tidy up your spatial index

"If you frequently add and delete data, you should compact your file or personal geodatabase on a monthly basis. You should also compact a geodatabase after any large-scale change. Compacting tidies up storage by reordering records and eliminating unused space. After compacting, the data in each file can be accessed more efficiently. Compacting also reduces the size of each file—it’s possible to be able to reduce the size of a geodatabase by one-half or more."

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Compacting_file_and_personal_geodatabases/003n0000007t000000/

Compact (Data Management)

"It is recommended to compact personal geodatabases when they become larger than 250 MB. If data entry, deletion, or general editing is frequently performed on a database, the database should be regularly compacted to ensure optimal performance."

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000000n000000

share|improve this answer
3  
If you're doing massive deletes, this is an important thing to do (especially for larger geodatabases). I've personally not had it reliably fix the extent problem, but it's definitely a good idea. –  Lou May 2 '12 at 15:42
add comment

Here is an ArcCatalog add-in for ArcGIS 10 that adds a command to update the feature class extent, likely using the same method as @Ragi's VBA code:

share|improve this answer
    
This link is an add-in that works great for me in 10.1 arcgis.com/home/item.html?id=576ebff497094274bdd7c76e456de6c3 –  Simon Jul 30 '12 at 23:48
add comment

The GeoDatabase Extent always expands out - never shortens automatically. Compacting and Compressing only optimizes storage and fragmentation, but not the Extent itself. I would try recreating the spatial index first and see if that does the trick.

Update:

Since the spatial index rebuilding doesn't do the trick, I am sure the following VBA code will:

Public Sub reCalcExt()
  Dim pGXApplication As IGxApplication
  Set pGXApplication = Application

  Dim pGxObject As IGxObject
  Set pGxObject = pGXApplication.SelectedObject

  If Not TypeOf pGxObject.InternalObjectName Is IFeatureClassName Then
    Exit Sub
  End If

  Dim pName As IName
  Set pName = pGxObject.InternalObjectName
  Dim pSchemaLock As ISchemaLock
  Set pSchemaLock = pName.Open

  pSchemaLock.ChangeSchemaLock esriExclusiveSchemaLock
  Dim pFeatureClassManage As IFeatureClassManage
  Set pFeatureClassManage = pSchemaLock
  pFeatureClassManage.UpdateExtent

  Exit Sub

ErrHandler:
  pSchemaLock.ChangeSchemaLock esriSharedSchemaLock
End Sub

You can do this in any other ESRI supported programming language. The trick is to get a schemalock and to use the IFeatureClassManage::UpdateExtent method.

share|improve this answer
    
I tried recreating the spatial index on a sample dataset, and that didn't help in my test case. I was honestly surprised. –  Lou May 2 '12 at 19:05
    
Updating my answer with some code then. –  Ragi Yaser Burhum May 2 '12 at 20:11
    
Nice! Good stuff, thanks for updating with it. –  Lou May 2 '12 at 20:30
    
By this way, this is ArcCatalog VBA code. –  Ragi Yaser Burhum May 2 '12 at 22:33
add comment

I don't know exactly what causes it in File Geodatabases, but I am indeed able to replicate it and it is something I've faced before. The only way I was able to find out how to bypass it is to Compress the file geodatabase. That will fix the extent issue. You will need to Decompress it when you're done, because you can't edit a Compressed file geodatabase.

During an edit/ArcMap session when you're actually using the data, you can always select all | zoom to selected as a workaround. It's not great, but I've used it in my workflow until I got to a breaking point where I could do that compress/decompress trick.

Note, Compacting will not work (at least, not reliably). It will rebuild your indices, but I've found it unreliable for fixing extent issues. It's still something you should do from time to time. I just tried it again right now, and it didn't work on my sample dataset. YMMV.

share|improve this answer
    
You can also move feature classes to a new geodatabase/shapefile, but I highly doubt that's an acceptable answer. However, on the odd chance that's part of your workflow (packaging the data for delivery) it may work for you and not require extra steps. –  Lou May 2 '12 at 14:58
add comment

If you want to update extent of feature classess in your mxd document this chunk of code might help you:

Dim pLayer As ILayer Dim pEnumLayer As IEnumLayer Dim pFeatureLayer As IFeatureLayer Dim pFeatureClass As IFeatureClass Dim pFeatureClassManage As IFeatureClassManage

    pEnumLayer = pMap.Layers
    pLayer = pEnumLayer.Next

    Do Until pLayer Is Nothing
        If TypeOf pLayer Is FeatureLayer Then
            pFeatureLayer = pLayer
            pFeatureClass = pFeatureLayer.FeatureClass
            pFeatureClassManage = pFeatureClass
            pFeatureClassManage.UpdateExtent()
        End If
        pLayer = pEnumLayer.Next
    Loop
share|improve this answer
add comment

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.