Hello,
 
I have a feature with 4 attributes and I want to add a new attribute.
So I created a new feature with the same attributes and adding the new
attribute :
 

//Feature with its attributes
Feature f;
AttributeType[] att = f.getFeatureType().getAttributeTypes();
 

//Attributes of new Feature
AttributeType[] types = new AttributeType[att.length+1];
 

//Set the the new Feature's attributes with the old one
for (int i =0; i<att.length ; i++){
 types[i] =
AttributeTypeFactory.newAttributeType(att[i].getName(),att[i].getType())
;
}
types[types.length-1]=AttributeTypeFactory.newAttributeType("levelOfProt
ect", Double.class);
 

//Create new FeatureType
FeatureType testSchema = FeatureTypeBuilder.newFeatureType(types,
"testSchema");
 

//Fill the attributes
Object[] attributes = new Object[types.length];
attributes[0] = f.getDefaultGeometry();
attributes[1] = f.getAttribute(1).toString();
attributes[2] = f.getAttribute(2).toString();
attributes[3] = Integer.parseInt(f.getAttribute(3).toString());
attributes[4] = f.getAttribute(4).toString();
attributes[5] = new Double(12);
 

//Create the feature
Feature result = testSchema.create(attributes);
 
 
But I have a problem to display that in GML.
Why...?
 
Thank you.
**********************************************************************************************
Le contenu de ce mél et de ses pièces jointes est destiné à l'usage exclusif du 
(des) destinataire(s) expressément désigné(s) comme tel(s). En cas de réception 
de ce 
 mél par erreur, le signaler à son expéditeur et ne pas en divulguer le 
contenu. 
L'absence de virus a été vérifié à l'émission du message. Il convient néanmoins 
de 
vérifier l'absence de contamination à sa réception. 
The contents of this email and any attachments are confidential. They are 
intended for 
the named recipient(s) only. If you have received this email in error please 
notify the 
system manager or the sender immediately and do not disclose the contents to 
anyone or make copies. eSafe scanned this email for viruses, vandals and 
malicious 
content.
**********************************************************************************************
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to