I have a shapefile with an attribute I want to compute programmatically in Java for each feature. I have found a lot of documentation on how to read and create shapefiles with geotools (http://docs.geotools.org/stable/userguide/library/data/shape.html http://osgeo-org.1560.x6.nabble.com/Add-an-attribute-to-all-the-features-of-a-shape-file-td4318371.html), but no documentation on how to modify an attribute.
So far, I am loading the shapefile data into a FeatureCollection
, and modifying each feature attribute with:
myFeature.setAttribute("ATTRIBUTE", myAttributeValue);
but these modifications are not stored into the shapefile (only in memory I guess).
Is there a way to make these modification persistent into the shapefile? Maybe there is a more standard and simple way to update feature attribute with geotools. The only thing I would like to avoid is to re-create a new shapefile.