[Gdal-dev] Newbie help please

Graham B no_spam_4_me at iinet.net.au
Wed Jan 12 16:09:18 EST 2005


Hi, I am Graham, living in Brisbane Australia. Certainly not an IT professional but I hope that ogr2ogr can help me do some basic edits to a large number of shapefiles.

I have a batch file as below (presently sitting in the FW tools\bin foldeer to eliminate any path issues while I get it working.

I am trying to update a shapefile called temp.shp

That is,  I want to open temp.shp and edit it such that only records where the field called FEAT_CODE = "sea" remain. Ideally I will update the original file but if ogr2ogr can create another shapefile called temp2.shp then that is OK too.

In the same folder I have the four components of the shapefile, i.e 

temp.shp
temp.prj
temp.dbf
temp.shx


If anyone can give me a couple of pointers to get me started I would really appreciate it.

Thanks in advance,
                             Graham B

ogr_ops.bat
========

echo off

rem ogr2ogr [-skipfailures] [-append] [-update] [-f format_name]
rem               [-select field_list] [-where restricted_where]
rem               [-spat xmin ymin xmax ymax]
rem               [-a_srs srs_def] [-t_srs srs_def] [-s_srs srs_def]
rem               [[-dsco NAME=VALUE] ...] dst_datasource_name
rem               src_datasource_name
rem               [-lco NAME=VALUE] [-nln name] layer [layer ...]]

echo off

rem call ogr2ogr -update -f "ESRI Shapefile" -where(FEAT_CODE =sea) temp.shp temp2.shp

call ogr2ogr 

pause
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20050113/23fdb67f/attachment.html


More information about the Gdal-dev mailing list