ogr2ogr with file list

Bill Binko bill at BINKO.NET
Tue Jul 26 13:49:09 EDT 2005


What Operating System (and which Shell -- if Linux/Unix) are you using?

If you're using Linux and bash (or something similar), you can do this:

(Assuming list.in has a list of input filenames in it)

for i in `cat list.in`; do ogr2ogr $i output_$i -t_srs WGS84 ; done 

Probably easier for automation would be to put all of your "input" 
shapefiles in an input directory and create an empty output directory. 
 Then run something like this:

for i in input/*.shp; do ogr2ogr $i output/`basename $i` -t_srs 
WGS84; done


Hope this helps.
Bill

On Tue, 26 Jul 2005, Yar Doroshenko wrote:

> Hi Guys,
> 
> I'm working on automating my shapefile coordinate conversions. I know how
> to do single file conversion:
> 
> ogr2ogr input.shp output.shp -t_srs WGS84
> 
> Now, can I automate the process? Let's say I have a list of shapefiles that
> I want to convert, would I do something like:
> 
> for %f in (path_here\list.in) do ogr2ogr %f
> 
> I tried this one in many different ways, but I do get errors.
> 
> Would anyone have a correct syntax for multiple file conversions?
> 
> Thank you
> 
> Yar
> 
> 



More information about the mapserver-users mailing list