clip geodatabase?

8798
5
11-25-2010 12:23 PM
GarretDuffy
Occasional Contributor
Hi,

I have a large geodatabase composed of many classes and features.

I would like to clip the geodatabase to a rectangular feature and maintain the same classes and features.

Is this possible without having to clip each class, etc. individually?

Thanks.

G
0 Kudos
5 Replies
EdwardGriffin
New Contributor II
What do you mean by rectangular feature?

If you have a rectangular feature for example a grid that you want to clip the dataset to - you just need to use the analysis tools, extract, clip function.

The input feature is your geodatabase, the clip feature is the rectangular feature

All classes will be retained in the output.

does this help?
denisedavis
Occasional Contributor III
If you are working in ArcGIS10, the following can be pasted into a python window (be sure to edit the paths to your folders) and it works great.

# Script Name: Clip Multiple Feature Classes
# Description: Clips one or more shapefiles of features
#              from a folder or geodatabase and places the clipped
#              feature classes into a geodatabase.
# Created By:  DD
# Date:        11/19/2010.

# Import ArcPy site-package and os modules
#
import arcpy
import os


# Set the input workspace
#
arcpy.env.workspace = "Add the path to your geodatabase here"

# Set the clip featureclass
#
clipFeatures = "Add the path to your clip file here"

# Set the output workspace
#
outWorkspace = "Add the path to your output geodatabase here"

# Set the XY tolerance
#
clusterTolerance = arcpy.GetParameterAsText()

try:
    # Get a list of the featureclasses in the input folder
    #
    fcs = arcpy.ListFeatureClasses()
    for fc in fcs:  
            # Validate the new feature class name for the output workspace.
            #
            featureClassName = arcpy.ValidateTableName(fc, outWorkspace)
            outFeatureClass = os.path.join(outWorkspace, featureClassName)
           
            # Clip each feature class in the list with the clip feature class.
            # Do not clip the clipFeatures, it may be in the same workspace.
            #
            if fc <> os.path.basename(clipFeatures):
                arcpy.Clip_analysis(fc, clipFeatures, outFeatureClass,
                                    "")
except:
    arcpy.AddMessage(arcpy.GetMessages(2))
    print arcpy.GetMessages(2)
0 Kudos
denisedavis
Occasional Contributor III
I just found a script that will work with arcgisscripting used in versions prior to ArcGIS10. I'm attaching it because it's pretty long. I hope one of these scripts will help you.
0 Kudos
AndyFairbairn
Occasional Contributor


you just need to use the analysis tools, extract, clip function.

The input feature is your geodatabase, the clip feature is the rectangular feature



At least with ArcMap 10.1 Advanced licence, the clip tool only accepts feature classes as inputs not [file] geodatabases (or feature datasets), so this won't work for people in many cases. I suspect that other licences/products (ArcMap on Server?) may do the above.

It is still pretty tedious to set up, but you can right click on the clip tool and select batch, and then create a row for each feature class you want to clip (need to create the new target geodatabase first). The "input features" browser will multi-select feature classes which helps.

Andy.
PhilMiller
New Contributor II

I know this is an old thread, but I thought I would update. If you have access to the production mapping extension, you can use the "Production Clip" tool to clip an entire database.

0 Kudos