[Gdal-dev] Newbie help please

Frank Warmerdam fwarmerdam at gmail.com
Wed Jan 12 16:32:25 EST 2005


On Thu, 13 Jan 2005 07:09:18 +1000, Graham B <no_spam_4_me at iinet.net.au> wrote:
>
> rem call ogr2ogr -update -f "ESRI Shapefile" -where(FEAT_CODE =sea) temp.shp
> temp2.shp 
>

Graham, 

I think you are getting somewhat close with the above.
Try something like:

 ogr2ogr temp2.shp temp.shp -where 'FEAT_CODE="sea"'

Somewhat perversely (in my opinion) the first filename
passed to ogr2ogr is the output file.   The second is the
input.  So I have switched things around.  Next, your 
argument to -where needs to be a seperate string (that
is you need a space after -where).  There are also 
some quoting issues that may vary by shell.  I believe
you can do as I have with single quotes around the 
whole comparison, and double quotes around the
string you are comparing to, but that might not do it
on win32. 

Lastly, there is currently no way to update a shapefile
in place by deleting features using OGR.  So you 
are stuck writing your subset to a new output file. 

Only a few OGR drivers (I think only some of the RDBMS
based formats) support deleting features.   And to use
it you would have to do the operation with something 
other than ogr2ogr.  

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the Gdal-dev mailing list