Not sure about what you are trying to do ....
The feature retrieved from a FeatureCollection represents a read-only row
in your shapefile. To edit you will need to call featureStore
modifyFeatures as in the tutorials; or using a FeatureWriter you can go
through the whole shapefile and make modifications as you write it out.
Secondly the feature content has to match the header of your DBF file; you
cannot add new attributes as each one has to match an existing column name.
What you can do is make a new shapefile (with your new column) and read
from your origional shapefile; and copy the values over (and your new
value) one feature at a time. This is what we do in the uDig "reshape"
operation.... which is used to add columns, remove columns, and generate
new columns from a small expression.
Jody
On Tue, Jan 31, 2012 at 11:50 AM, Yang <[email protected]> wrote:
> currently we have features stored shape files, and we query them by
> "intersection" filter with a lat-lon point.
>
> collection = myFeatureSource.getFeatures(query);
>
> we would like to add certain custom attrs/data to the feature. currently
> we pull out the standard properties by
>
>
> FeatureIterator<SimpleFeature> iter = collection.features();
>
> while (iter.hasNext()) {
> SimpleFeature feature = iter.next();
> Collection<Property> props = feature.getProperties();
>
>
>
> but after I manually added the custom attr to the .xml data store file,
> the above call on "feature.getProperties()" does not return this new
> custom property.
>
>
> I also tried SimpleFeature.getAttributes(), it's basically the same result
> as getProperties()
>
> anything else I could try??
>
> Thanks a lot
> Yang
>
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users