Joshua Portway wrote: > Sorry to be such a pain, but now that we seem to have found a method > for creating and tracking Features, I'd just like to check that the > way I'm modifying them is correct : > > As far as I can tell there isn't actually a simple way to retrieve a > Feature from a dataStore, modify it, and then write it back to the > dataStore - is this correct ? Correct; we work on the model of a transaction. Often you will take data from several sources work on them together and then commit.
What you describe is similar to the GetFeaturesWithLock request that WFS does - basically lock a bunch of features so other threads cannot manipulate it, and then when you perform your transaction using those features you provide your lock. The locks are for a time period, possibly hours or days. > From looking at the sample code and searching the Javadocs it seems > that the only way to modify a feature is to use the > FeatureStore.modifyFeatures() method using a filter which filters only > the Feature I'm interested in. Also, it looks like using this > technique I can only modify one attribute of the feature at a time, so > I need to know what's changed and then do the procedure above once for > each attribute that's changed. Is this correct ? You can modify several attributes at a time. The other thing you can do is go through with a FeatureWriter and modify the features you requested one at a time calling write(). The FeatureIterator should be able to do that as well (it makes a copy and then will call write() if the copy is different). But as you surmise you are in relatively untested territory. Send your feedback early and often ;-) > If it's correct can you explain why there isn't just a > dataStore.modifyFeature(Feature) method which would just write a > feature back to the datastore? That would be a helper method; it makes good sense to me - do you want to add it as a feature request? > I keep getting the feeling that there must be something really > fundamental I'm missing, or that I must be trying to use the library > in the wrong way because the problems I keep bumping into seem like > most fundamental operations (creating and modifying features, for > instance) but they seem to be very complicated. I think what you are missing is the WFS specification ;-) I had to figure it out once and made nice sequence diagrams: - http://vwfs.refractions.net/docs/Validating_Web_Feature_Server.pdf - http://vwfs.refractions.net/ has more information including the research and design documents for this stuff > It's quite hard to understand why there's a batch operation for > modifying a single attribute of a bunch of Features, but (apparently) > no method for just writing a single Feature back to the store - unless > I'm completely misunderstanding how to use a dataStore or something. Nope; DataStore was written for GeoServer and it does not have modifying a single feature as a use case. Seriously your modifyFeature( Feature ) use case sounds just fine, let's add it to the data access proposal so we don't forget: - http://docs.codehaus.org/display/GEOTOOLS/Data+Access+API+for+ISO+Coverage+and+ISO+Feature Cheers, Jody ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
