ogr2ogr reprojection

Rahkonen Jukka Jukka.Rahkonen at MMMTIKE.FI
Thu May 18 02:05:30 EDT 2006


Hi,
 
Another alternative is to make one batch file (.bat) for the actual conversion and call it with parameters from another. Like this
 
convert.bat
========
 
ogr2ogr [-all fixed parameters like -s_srs and -t_srs here] %1 %2
 
 
call_convert.bat
===========
call convert.bat destination_1 source_1
call convert.bat destination_2 source_2
call convert.bat destination_3 source_3
etc.
 
Conversion is started by running "call_convert.bat", and "destination_1" and "source_1" will be treated as %1 and %2 by the "convert.bat", respectively.
 
To start with call_conver.bat you can first insert all your shapefiles there by command
dir /b *.shp >call_convert.bat
 
dir /b /s puts there all shapefiles from subdirectories as well.
 
This may be a brutal way but it has some advantages.  For example you can add some extra commands to "convert.bat"  to be executed after each conversion. This way I use to make log files with time stamps about raster file batch conversions.
 
Regards,
 
-Jukka Rahkonen-
 
 

________________________________

Lähettäjä: UMN MapServer Users List puolesta: Jelmer Baas
Lähetetty: to 18.5.2006 8:17
Vastaanottaja: MAPSERVER-USERS at LISTS.UMN.EDU
Aihe: Re: [UMN_MAPSERVER-USERS] ogr2ogr reprojection



Zhonghai Wang wrote:
> Hi,
>
> I've tried with this batch command, but I failed, because I don't know
> how to specify the -s_srs and -t_srs parameters, should it be something
> like this?
>
>>  for %a in (*.shp) do ogr2ogr.exe %a -init=epsg:4326 -init=world:CH1903
>
> **init=world:CH1903 is for switzerland, and I am sure that this
> projection code is right.

yeah, this should do it. Sorry for my short last response though.

This should execute
ogr2ogr.exe <filename> -init=epsg:4326 -init=world:CH1903

For each .shp file you have. What is the error you receive? Perhaps the
ogr2ogr.exe isn't in the same folder?

--
Jelmer Baas



More information about the mapserver-users mailing list