clip geodatabase?

10329
6
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
6 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
BrittanyDahl
New Contributor

Another option is to use Distributed Geodatabase and use the Extract Data - tool https://desktop.arcgis.com/en/arcmap/latest/manage-data/geodatabases/copy-geodatabase-schema-with-ex... - Pick Data, and Show Advanced Options for overriding data extraction defaults when I click Next. You then have an option to clip the all/any database content into a new .gdb, clipped to current extent, a specified extent or boundary of selected graphic. 

BrittanyDahl_0-1704431761682.png

 

0 Kudos