[gdal-dev] Using GDAL to update DBFs of an ESRI Shapefile ?

Even Rouault even.rouault at mines-paris.org
Thu Sep 1 13:49:52 EDT 2011


Le jeudi 01 septembre 2011 19:29:58, vasile a écrit :
> I failed in finding a programatic way of updating the attributes of an ESRI
> Shapefile feature (using Ruby 1.9.x on OSX Lion) therefore I wonder if I
> can use GDAL to accomplish this task.
> 
> Let's say I have a CSV file containing the fields/rows that I want to
> update and an ESRI shapefile with the associated .dbf. Basically I want to
> update only the DB with the content from CSV. Is it possible ?

Yes, the shapefile driver supports editing both the geometry and attributes of 
an existing datasource. Not sure about the state of Ruby bindings to do that 
(they lack a dedicated maintainer), but you could certainly accompish that 
with C, C++, Java, C#, Perl or Python.

Your friends are the Feature.SetField() and Layer.SetFeature() methods.

> 
> Thanks,
> 
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/Using-GDAL-to-update-DBFs-of-an-ESR
> I-Shapefile-tp6750885p6750885.html Sent from the GDAL - Dev mailing list
> archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list