Hello, why don't you use a FeatureTransformer? The usage is given in the javadoc for this class.
Hope it helps, Kerstin -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Reiche, Liane Gesendet: Dienstag, 5. Dezember 2006 11:34 An: [email protected] Betreff: Re: [Geotools-gt2-users] FeatureCollection to GML Hi, This is my attempt I have figured out during the last days FeatureType ft = colFeatures.features().next().getFeatureType(); Schema s = SchemaFactory.getInstance(ft.getNamespace()); DocumentWriter.writeDocument(colFeatures, s, filOut, null); It works, but I had to change a line in DocumentWriter.java in WriterContentHandler.findElement(String): From: if (((elems[j].getName()) != null) && (elems[j].getName()).equals(name)) { return elems[j]; } To: String strPre = searchOrder1[i].getPrefix(); if (strPre != "") strPre = strPre + ":"; if (((strPre+ elems[j].getName()) != null) && (strPre + elems[j].getName()).equals(name)) { return elems[j]; } My data came from a WFS so I did need the prefix. But I'm not sure, if this is the appropriate change. One problem left: This procedure doesn't write out the BoundingBox, because of not matching Envelope to Geometry. So I have no bounding box attribute in my .gml File. Hope it helps. Regards, Liane ----------------------------------------------------- Liane Reiche Landwirtschaftskammer NRW Referat 22 - Anwendungsentwicklung Nevinghoff 40 48147 Münster Telefon: 0251 / 2376 - 983 Telefax: 0251 / 2376 - 818 E-Mail: [EMAIL PROTECTED] ----------------------------------------------------- -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Jody Garnett Gesendet: Mittwoch, 15. November 2006 01:18 An: Victor Meirelles Cc: Justin Deoliveira; Geotools 2 Betreff: Re: [Geotools-gt2-users] FeatureCollection to GML Victor Meirelles wrote: > Hi All, > How can I put a FeatureCollection into a GML File. Anybody has a code > sample? GeoTools has an XML Transform written to accomplish this; code example should live here (but does not yet): - http://docs.codehaus.org/display/GEOTDOC/03+XML+Transform Next source of examples is test cases: - http://svn.geotools.org/geotools/trunk/gt/modules/library/xml/src/test/java/ org/geotools/xml/ogc/GeometryEncoderTest.java - http://svn.geotools.org/geotools/trunk/gt/modules/library/xml/src/test/java/ org/geotools/xml/ogc/XMLEncoderTest.java Did not see one that directly did a feature collection; better ask justin who has just looked into this for geoserver. Jody ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
