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

Moritz Lennert mlennert at club.worldonline.be
Thu Jul 24 09:41:46 EDT 2008


On 24/07/08 15:13, Glynn Clements wrote:
> 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).

I won't make an issue of this, but there is a difference in that 
v.in.ogr takes a data source (directory or file) as input, and this data 
source can contain many layers. AFAIK, it's the only *.in.* module to do 
this.

But I don't care enough to worry about it... loops work fine for me. 
Just don't really understand the advantage of loading all layers into 
different layers of a GRASS map...

Moritz


More information about the grass-user mailing list