|
From: Matthias L. <mat...@gf...> - 2009-09-02 13:20:17
|
Hi, I have a FeatureCollection containing some hundred features and I want to add two attributes to each Feature. The two attributes are generated/calculated for each Feature on the basis of the Feature's geometry and other (application internal) values. All other attributes of the Feature are not used for this calculation but must be part of the resulting Features. And they are not known since I'm developing a more or less generic (GeoTools-) Process for this task. This means I have to change the FeatureType but AFAIK the FeatureType is immutable. What is the best/most efficient way to realize the addition of two new attributes? - create a new FeatureType, - iterate over the given (old) FeatureType and copying all the attributes into the new one (I think I don't have to iterate, I can copy them in one bunch) - add my two additional attributes - copying each Feature into a new one Feature (with all it's attributes) - set my calculated attributes I'm no expert in the GeoTools library: are there any Factories/Helper/Convenience classes that could support me? Maybe I'm on the wrong track and all the steps above can be skipped with just one mysterious command. Thank you! Matthias |