[OSGeo-Discuss] methods for programatically adding fields to
szekerest at gmail.com
Fri Oct 31 18:10:51 EDT 2008
I think it wouldn't be a big deal extending OGR SQL to accept constant
values in the select list.
In this case the parser would place the constant value into the
field_name memeber of swq_col_def, and field_index = -1 would denote
that it should be treated as a constant
in OGRGenSQLResultsLayer::TranslateFeature when copying the features over.
2008/10/29 Tyler Erickson <tyler.erickson at mtu.edu>:
> 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
> 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
> 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.
> Discuss mailing list
> Discuss at lists.osgeo.org
More information about the Discuss