[gdal-dev] Using OGR to modify shapefile field values

Robb K. Wright robbkwright at gmail.com
Fri Jun 29 05:12:30 PDT 2012


1) I am looking for a way to use ogr command-line utilities to modify 
the contents of fields within a shapefile. It isn’t a problem to modify 
one step at a time/put in a loop where each change creates a new output 
– that is manageable – but I’m missing the SQL statement to say “if 
FIELDX=’abc’, then FIELDB=’123’. I could use the select statement to 
pull out only the records where FIELDX=’abc’ (+ other statements, then 
merge back), but how to I set FIELDB=’123’?

2) As an extension to the above question, I’d like to modify the values 
based on a time statement – something along the lines of “if DATE_FIELD 
is = (CURDATE – 1), then FIELDX=’24h’”. Can these SQL date queries be 
made through OGR?

3) The above questions aren't really gdal development questions - is 
there a more appropriate forum to submit these “use” questions?

Robb


More information about the gdal-dev mailing list