From: Georg W. <wa...@un...> - 2009-08-03 13:20:36
|
Justin Deoliveira wrote: > > Hi Georg, > > Which version of GeoTools are you using? The GML2 support has been > improved in more recent versions. > > -Justin > > Georg Walenciak wrote: >> Hello, >> I am trying to encode a FeatureCollection to a gml Document using the >> code >> snippet i found in the geotools user guid >> (http://docs.codehaus.org/display/GEOTDOC/GML+XML+Support) >> I'm using the code to parse a gml document without a schema which already >> works quite fine. Now i'm trying to encode a featurecollection to a gml >> document with the code posted at the end of this document. Streaming the >> "xml" to a document returns the following result: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <gml:_FeatureCollection xmlns:gml="http://www.opengis.net/gml" >> xmlns:xlink="http://www.w3.org/1999/xlink"/> >> >> But I know that the featurecollection is not empty since i used the >> recentliy parsed featurecollection. >> Can anyone help me out with this problem? >> Thanks >> >> Georg Walenciak >> >> >> public void createGmlFeatureCollection(FeatureCollection >> featureCollection){ >> >> org.geotools.xml.Configuration configuration = new >> org.geotools.gml2.GMLConfiguration(); >> org.geotools.xml.Encoder encoder = new org.geotools.xml.Encoder( >> configuration ); >> >> //output stream to serialize to >> ByteArrayOutputStream xml = new ByteArrayOutputStream(); >> >> try { >> >> >> encoder.encode(featureCollection,org.geotools.gml2.GML._FeatureCollection,xml); >> >> } catch (IOException e) { >> // TODO Auto-generated catch block >> e.printStackTrace(); >> } >> } > > > -- > Justin Deoliveira > OpenGeo - http://opengeo.org > Enterprise support for open source geospatial. > > ------------------------------------------------------------------------------ > 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 > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > hi justin, i was using geotools-2.5.5... using geotools-2.6-M1 solved the problem than you very much for help best regards georg -- View this message in context: http://n2.nabble.com/Encoding-FeatureCollection-to-GML-returns-empty-GML-Document-tp3315115p3377620.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. |