In this article you will learn how to clip all the features (or shapefiles, as you prefer to call them) contained in a database using a shapefile.
The following procedure will help you when you have to trim spatial information considering the geometric shape of a specific shapefile; I advise you to carry out this procedure once you finish your project. To achieve this we will use a Python code developed by me, but first let's see what your conventional options would be:
Option 1: how to geometrically crop a feature using the ArcMap (ArcGIS) layer editor.
Option 2: how to geometrically crop a feature using geoprocessing tools
How to geometrically trim features within a database with Python (ArcPy)
Step 0: Always make a backup of your data before making a modification.
Step 1: Open a blank MXD file, and press the “Pause drawing” button (a) or press F9 on your keyboard (This is to avoid the MXD file to collapse because of so much information).
Step 2: Load the layers to be clipped into the MXD, including the layer that will serve as the geometric clipping shape.
Step 3: Open the Python window in the Standard toolbar.
Step 4: Copy the following code into a notepad and replace the text Clipper in line #04 with the name of the layer that will serve as the geometric clipping shape.
Step 5: Copy the modified code into the Python window and press the Enter key twice.
After a few seconds you will see the “Clip (Data Analysis)”, “Delete (Data Management)” and “Append (Data Manangement)” tools start to run in the lower right corner, and after some time all the layers contained in the MXD will have been clipped.
Notes:
(a) If you want to be able to verify the result of the clipping before it is final, you can start an edit session before running the code.
I hope you enjoyed this article, soon I will upload a video explaining the procedure that you will be able to consult in this blog. Save my blog among your favorite links, I will be uploading many more tricks of this style, remember that you can send me your concerns in the contact page or leave your comment, I will be attentive to respond.









