Like rasters, occasionally you only need vector data to cover a certain area of study (area of interest). Also, like rasters, you can use a layer defining the extent that you want to select only for a portion of a vector layer to make a new layer. The tool that is used for this job is Clip; that is, 'Cookie Cutter' because of how the results look afterwards.
For the example in this recipe, we will use geology.shp and clip it to the extent of Wake County using census_wake2000.shp. Any vector layer with the aggregation of polygons covering all of the county will work.
geology.shp and census_wake2000.shp, layers.
geology.shp.
All clipping is based on the principle of intersection features. For each feature in Input, the tool checks to see whether it intersects with the overall shape of clip layer. When it does intersect, the algorithm then checks whether any part falls outside the intersection. When a part lands outside, it is cut off.
You have to be careful when using clip. If the original table contained columns that included measurements such as area and perimeter, these values are copied from the original. Therefore, they may not reflect the new size of and shapes that were cut.
Generally, all geometry operations and analysis should be done with layers in the same projection in order to ensure consistent results. Also, many tools are not projection aware and won't compensate for two source layers being in different projections.
Tools that create the intersection of objects (for example, in PostGIS's and SpatiaLite's ST_Intersection) can provide you with similar results. However, you may need to perform multiple steps: Intersect, then select by contains or intersection to eliminate unwanted data.