I do this a lot.  If both the input and the output arguments to ogr2ogr are directories then it will clip all of the shapes in the source directory and write them to the output directory.  In my case I let it create the output directory but it mi9ght work to write to an existing directory.  I use linux by the way so I don't know if it works this way on Windows or Mac.

So: ogr2ogr -clipsrc mask.shp output source

Shapefiles are the default so you don't even need the -f "ESRI Shapefile".

Koos Hagg wrote:
Hi All,
have been searching around for the answer to this question, and found an old thread on this list.

I have a folder which contains about 30 shapefiles, old (but still useful) vmap0 data, but it is 500mb in size. I'd like to clip each shapefile to just the region I need.
I understand about ogr2ogr, and I could do it one by one,

but I would like to figure out how to write a batch file to do it all at once. However- I have been trying this and that for a while, not making any progress.

any help is appreciated!


Koos



Date: Thu, 15 Mar 2012 19:59:44 +0200
From: Zirneklitis <[email protected]>
Subject: Re: [Qgis-user] Clipping 60 shape layers
To: [email protected]

Use ogr2ogr:

ogr2ogr -f "ESRI Shapefile" -clipsrc mask.shp output.shp input.shp

Karlis

Bis Nulama wrote:
> ..
> I have 60 shape layers and I would like to cut them on a poligon shape
> (region boundary).
> Is there a way to do this selecting all the 60 layers at once (and not
> repeating the clip command 60 times)?
> ..
_______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user



_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to