Dominique,
I replied to the list, but thought I'd also copy it to your email address
too:
In this code snippet I've retrieved a feature from a SimpleFeatureCollection
using an iterator and display it with toString():
.
SimpleFeature feature = iter.next();
System.out.println("feature as string: " + feature.toString());
For gml this will output all features in the collection as GML.
FeatureTransformer ft = new FeatureTransformer();
// set the indentation to 4 spaces
ft.setIndentation(4);
// this will allow Features with the FeatureType which has the namespace
// "http://somewhere.org" to be prefixed with xxx...
ft.getFeatureNamespaces().declarePrefix("xxx","http://somewhere.org");
// transform
System.out.println("features as gml: ");
ft.transform(selectedFeatures,System.out);
For more info on GML, see
http://docs.geotools.org/latest/javadocs/org/geotools/gml/producer/FeatureTr
ansformer.html
Hope this helps,
Hal
From: Bessette-Halsema, Dominique E [mailto:[email protected]]
Sent: Wednesday, August 28, 2013 4:00 PM
To: [email protected]
Subject: [Geotools-gt2-users] convert simplefeature
Does anyone know how to convert a simplefeature object to xml, gml or a java
String?
Thanks!
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users