R: [GRASS-user] import multiple shapefiles automatically

Martin Wegmann wegmann at biozentrum.uni-wuerzburg.de
Thu Jun 19 08:40:49 EDT 2008


On Donnerstag, 19. Juni 2008 14:30:45 marco.pasetti at alice.it wrote:
> >is there a way to tell GRASS to import all the shapefiles in a certain
> > folder (I've tried *.shp but it didn't work), and give each output map
> > the same name as the original shapefile?
>
> v.in.ogr 'dsn=C:\QGIS\species_shapefiles'
>

haven't tried this before, but sounds great, alternatively you can try it with 
a script:

#!/bin/bash

echo "import shape files"
for i in *.shp ; do
	base = ${i%.*} #I found this in my old code, no idea why ,-)
	v.in.ogr  input=$i output=$i
done

the shell need to be run in the folder with you shp files.

Martin






More information about the grass-user mailing list