There are a couple ways to modify a feature:

- calling FeatureStore.modifyFeatures; or
- using a FeatureWriter (which allows you got go through each feature; call 
setAttribute as you are doing; and then call write() before going on to the 
next() )

Yes you need to be within a transaction; while Transaction.AUTO_COMMIT works; 
in many cases it is inefficient (example writing out the entire shapefile each 
time you modify a feature).

For details see the user guide:
- http://docs.geotools.org/latest/userguide/tutorial/feature/csv2shp.html 
(tutorial)
- http://docs.geotools.org/latest/userguide/library/api/datastore.html (api)
- http://docs.geotools.org/latest/userguide/library/data/featuresource.html 
(exam-examples)

-- 
Jody Garnett


On Wednesday, 6 July 2011 at 6:39 AM, Ivan Willig wrote:

> Hi list. 
> I am trying to modify a org.geotools.feature.simple.SimpleFeatureImpl. I am 
> using the setAttribute(String name, Object value). Do I need to do this 
> within an transaction? 
> Any tests or example code that someone could point me to? 
> 
> Thanks. 
> Ivan Willig
> 
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security 
> threats, fraudulent activity, and more. Splunk takes this data and makes 
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2d-c2
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected] 
> (mailto:[email protected])
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to