1. Create a SimpleFeatureTypeBuilder 2. Configure it with your origional using builder.init( schema ) 3. Add your additional attributes 4. Call build to get the new schema
Jody On Wed, Sep 2, 2009 at 11:19 PM, Matthias Lendholt<[email protected]> wrote: > 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 > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Geotools-gt2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
