[FWTools] batch reproject shapefiles

Bryan Keith bryan at ideotrope.org
Wed Oct 1 15:57:36 EDT 2008


> as a complete n00b to batch variables, i'm having a little difficulty...
>
>
> C:\user\shp\census>batchreproj.bat
>
> C:\user\shp\census>set prj_params=-s_srs epsg:4269 -t_srs epsg:2229
>
> C:\user\shp\census>for %g in (*.shp) do (ogr2ogr -f "esri shapefile"
> -s_srs
> ep
> sg:4269 -t_srs epsg:2229 output\%g %g )
>
> C:\user\shp\census>(ogr2ogr -f "esri shapefile" -s_srs epsg:4269 -t_srs
> epsg:2
> 229 output\fe_2007_06083_taz00.shp fe_2007_06083_taz00.shp )
> ERROR 1: Failed to create file .shp file.
> ERROR 4: Failed to open Shapefile `output\fe_2007_06083_taz00.shp'.

Larso,

Does the "output" directory exist?

Maybe try "mkdir output" before running the script?

Bryan

>
> ERROR 1: Terminating translation prematurely after failed
> translation of layer fe_2007_06083_taz00
>
>
> On Wed, Oct 1, 2008 at 9:09 AM, Matt Wilkie <matt.wilkie at gov.yk.ca> wrote:
>
>> If you're on windows, try something like this:
>>
>>   set prj_params=-s_srs epsg:4617 -t_srs epsg:3578
>>
>>   for %%g in (*.shp) do (
>>      ogr2ogr -f "esri shapefile" %prj_params% output\%%g %%g
>>      )
>>
>>
>> Change prj_params to suit your source and destination projections of
>> course. There are some more involved examples at
>> http://code.google.com/p/maphew/source/browse/#svn/trunk/gis/canvec
>> and http://code.google.com/p/maphew/source/browse/#svn/trunk/gis/geobase
>>
>> cheers,
>>
>> matt wilkie
>> --------------------------------------------
>> Geographic Information,
>> Information Management and Technology,
>> Yukon Department of Environment
>> 10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
>> 867-667-8133 Tel * 867-393-7003 Fax
>> http://environmentyukon.gov.yk.ca/geomatics/
>> --------------------------------------------
>>
>>
>> pyroGIS wrote:
>>
>>> hello members,
>>>
>>> i've recently seen the light and have begun a full embrace of FWTools,
>>> gdal, ogr2ogr, etc. i imagine this is a basic question for some of you
>>> out
>>> there:
>>>
>>> what is the syntax for a batch reproject operation of a folder full of
>>> shapefiles from one coord sys to another?
>>>
>>> i cannot find an example within the -help or through various google
>>> queries...thank you_larso
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> FWTools mailing list
>>> FWTools at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/fwtools
>>> http://fwtools.maptools.org/
>>>
>>
>>
> _______________________________________________
> FWTools mailing list
> FWTools at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/fwtools
> http://fwtools.maptools.org/
>




More information about the FWTools mailing list