[Qgis-user] Clipping 60 shape layers

Salvatore Larosa lrssvtml at gmail.com
Mon May 7 06:51:38 PDT 2012


Il giorno lun, 07/05/2012 alle 19.56 +0700, Koos Hagg ha scritto:
> 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!
> 
Hi Koos,
I didn't test it!

#!/bin/bash
i=1;
for f in *.shp; do 
ogr2ogr -f "ESRI Shapefile" -clipsrc mask.shp `basename
$f .shp`_out_[$i].shp $f;
i=$((i+1));
done;
> 
Hope this helps!

Regards,

-SL


-- 
Salvatore Larosa
linkedIn: http://linkedin.com/in/larosasalvatore
twitter: @lrssvt
skype: s.larosa
IRC: lrssvt




More information about the Qgis-user mailing list