[OSGeo-Discuss] methods for programatically adding fields to shapefiles

Tyler Erickson tyler.erickson at mtu.edu
Wed Oct 29 14:48:51 PDT 2008


I am interested in approaches for adding a populated field to a shapefile
(for example, adding a new field named 'source_url' with the value
'http://somewebsite.com').  I would like to do this for several thousand
files.

At first I thought that I might be able to accomplish it using ogr2org with
a sql clause, such as:

ogr2ogr -sql "select *, 'http://somewebsite.com' as source_url from infile"
outfile.shp infile.shp

but that didn't work since ogr2ogr supports a limited set of SQL, described
at:
http://www.gdal.org/ogr/ogr_sql.html

Any ideas on how to accomplish this? (I would prefer suggestions that can be
scripted with python.)

- Tyler
-- 
View this message in context: http://n2.nabble.com/methods-for-programatically-adding-fields-to-shapefiles-tp1395535p1395535.html
Sent from the OSGeo Discuss mailing list archive at Nabble.com.




More information about the Discuss mailing list