[GRASS-user] import a folder full of shapefiles and reproject on-the-fly?

Glynn Clements glynn at gclements.plus.com
Thu Jul 24 09:13:05 EDT 2008


Moritz Lennert wrote:

> >>> Use ogr2ogr to reproject Shapefiles outside GRASS (it accepts 
> >>> directory of shapefiles as input as well as single shapefiles) and
> >>>  then import them all with v.in.ogr. You can automate v.in.ogr in 
> >>> Shell using "for in do" syntax (plenty of examples in the archive or 
> >>> Google it).
> > 
> >> I don't think you actually need a for-loop. From the v.in.ogr man page:
> >>
> >> layer=string[,string,...] OGR layer name. If not given, all available
> >>  layers are imported
> >>
> >> So, normally, if you don't give a layer all the shapefiles in the 
> >> directory (dsn=) will be imported.
> > 
> > Note this loads the Shapefiles as *layers* (in the GRASS meaning of it)
> > of a single output vector map. Not necessarily what one might want.
> 
> No definitely not. Didn't know that. IMHO this should be changed...

If you want to load multiple files as individual maps, run v.in.ogr in
a loop.

I don't see any reason to add this functionality to every *.in.*
module, and even less reason to add it to some modules but not others.

In general, each *.in.* module generates a single map. The only
exception which I can think of is for multi-channel (e.g. RGB) raster
files, where each channel is imported as a separate raster map (GRASS
itself doesn't support multiple channels in a raster map).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list