I am trying to replace a naïve bounding box clip when I download data for a study area using ogr2ogr, to one that uses a study area layer with an actual geometry.
ogr2ogr supports both -clipdst
and -clipsrc
arguments. The documentation gives this explantory text:
Clip geometries to one of the following:
- the specified bounding box (expressed in source SRS)
- a WKT geometry (POLYGON or MULTIPOLYGON expressed in source SRS)
- one or more geometries selected from a datasource
- the spatial extent of the -spat option if you use the spat_extent keyword.
When specifying a datasource, you will generally want to use -clipsrc in combination of the -clipsrclayer, -clipsrcwhere or -clipsrcsql options.
However, it is the same text for both -clipdst
and -clipsrc
. So I'm left wondering what the difference is. My assumption is that -clipsrc
applies a clip (whether bbox, geom, etc.) to the source, whereas -clipdst
applies to the output that is being written.
My situation is this: I'm using a layer (from PostgreSQL) to clip geometries being dowloaded from a WFS endpoint to a GPKG. Should I use -clipsrc
or -clipdst
?
Presumably -clipsrc
might put the work onto the server, but -clipdst
(without -clipsrc
) would do it on the client end, but I don't know. I don't know if it's redundant to give both. None of the layers I'm downloading are so large that I can't download them in their entirety and then clip—presumably if that wasn't the case I'd need to -clipsrc
.