Hello!
You have reached an area where the GeoTools library needs work; what
you need to output your file as GML - is the "XSD" file matching your
SimpleFeatureType. The wiki page provides an example that you can
modify; but right now we do not have any code that does this for you.
Once you have an XSD file the encode file will be able to help you.
The idea of a "GML" file does not exist; it is simply a convention
used when defining your own XML file. When you define your own (using
the ideas in GML) you will have an XSD file describing your file
format; which GeoTools can then encode against.
Jody
On Wed, Oct 28, 2009 at 6:25 PM, Soravis <
[hidden email]> wrote:
>
> I am trying to encode a FeatureCollection to a gml Document by reading
> features from MySQLDataStore. but result document was nothing. like this
>
> <?xml version="1.0" encoding="UTF-8"?>
> <gml:_FeatureCollection xmlns:gml="
http://www.opengis.net/gml"
> xmlns:xlink="
http://www.w3.org/1999/xlink"/>
>
>
> *** featurecollection have been checked that also got the data inside.
>
> my jsp code are following:
>
> /*----------------------------------------
> * read FeatureCollection from MySQL
> ------------------------------------------*/
> MySQLDataStore store = (MySQLDataStore) DataStoreFinder.getDataStore(map);
> org.geotools.data.FeatureSource<org.opengis.feature.simple.SimpleFeatureType,
> org.opengis.feature.simple.SimpleFeature> fsource;
> fsource = (org.geotools.data.FeatureSource)
> store.getFeatureSource("MYWPS_TEMP01");
> FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,
> org.opengis.feature.simple.SimpleFeature> db_fc = fsource.getFeatures();
>
> /**---------------------------------------
> * FeatureCollection Encoding
> ------------------------------------------*/
> org.geotools.gml2.GMLConfiguration gml_config = new
> org.geotools.gml2.GMLConfiguration();
> org.geotools.xml.Encoder enc = new org.geotools.xml.Encoder( gml_config );
> java.io.FileOutputStream file_out = new
> java.io.FileOutputStream("F:\\tomcat_webapps\\prj_mywps\\mywps\\test\\writedGml.xml");
> enc.encode(db_fc,org.geotools.gml2.GML._FeatureCollection,(OutputStream)
> file_out);
>
> Can anyone help me out with this problem?
> Thanks
> --
> View this message in context:
http://n2.nabble.com/Encoding-GML-FeatureCollection-from-MySQLDataStore-tp3903921p3903921.html> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>
http://p.sf.net/sfu/devconference> _______________________________________________
> Geotools-gt2-users mailing list
>
[hidden email]
>
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users>
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users