In this article you will learn how to clip all the features (or shapefiles, as you prefer to call them) contained in a database, based on a given geographic extent.
The common practice when talking about clipping a layer involves the use of the “Clip” tool in ArcGIS, where a layer is used as a boundary to define the clipping. However, this can be inefficient when trying to clip all layers of a database.
The following procedure will be useful, especially when you need to clip spatial information considering a box. I use it to crop the cartography to the extent of my Dataframe, thus avoiding information gaps in the spatial region presented. Another advantage is that in the end only the data necessary for the study remains, eliminating any surplus and thus reducing the size of the information handled.
To achieve this, we will use a little known toolbar of ArcGIS (ArcMap), called Distributed Geodatabase. The steps to follow are as follows:
How to use Distributed Geodatabase to clip multiple features contained in a spatial database (File geodatabase .gdb or Personal geodatabase .mdb).
1. Create a file geodatabase or personal geodatabase. To do this, go to the “ArcCatalog” or “Catalog” tab within ArcMap from the “Standard” toolbar (a), locate the folder where you want to save the clipped database (b), right click and select “New” (c), and then select “File Geodatabase” (d). This will create a database called “New File Geodatabase.gdb”, which for this example has been renamed CLIP (e).
2. Create a layer group in a blank MXD file and unmap it. This will prevent the program from crashing due to the number of layers loaded at the same time. Then, load all the information from the database into the layer group as shown in the following sequence of images.
3. Right click on the ArcMap menu bar (a), select the “Draw” button (b), on the “Draw” toolbar, select the “Rectangle” command (c) and proceed to define the geographic extent to be cropped with a drawing box (d). Make sure that the box is selected (e).
4. Right click on the ArcMap menu bar (a), select the 'Distributed Geodatabase' button (b) and click the 'Extract Data' button (c) in the newly displayed toolbar.
5. A window called 'Extract Data Wizard' will be displayed, select the 'Open geodatabase' button (a) and choose the new database where the clipped data will be stored, the same as in step 1. Make sure all options are selected as shown in views 1, 2 and 3.
At the end of the process, you will have the trimmed data in the database created in step 1. Below is the before and after:
BEFORE:
AFTER:
As you can see, this is not a geometric cut, but everything that is overlapped by the drawn rectangle is copied to the target database keeping its original shape. If you need to cut a database geometrically with a layer, I recommend you to review my article PYTHON GIS - Geometrically clip all features contained in a database.
I hope you enjoyed this article. Soon, I will upload a video explaining the procedure that you will be able to check in this blog. Save my blog among your favorite links, where I will be sharing many more tricks of this style. Remember that you can send me your questions through the contact page or leave your comment; I will be attentive to answer.







