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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to