Hi,

I am trying to export features to KML for reuse in googleearth.

The ID and the geometry is exported successfully, but the attributes "a" 
and "b" not.

How can that be done?

Thanks for Your  support.

Rainer

public static void main(String[] args) throws IOException {
         SimpleFeatureTypeBuilder stb = new SimpleFeatureTypeBuilder();
         stb.setName("test");
         stb.add("the_geom", Point.class);
         stb.add("a", String.class);
         stb.add("b", String.class);
         SimpleFeatureType type = stb.buildFeatureType();
         SimpleFeatureBuilder sb = new SimpleFeatureBuilder(type);
         DefaultFeatureCollection fc = new 
DefaultFeatureCollection("test", type);
         GeometryFactory geomFac=new GeometryFactory();
         fc.add(sb.buildFeature("1", new Object[] 
{geomFac.createPoint(new Coordinate(1,1)), "a1", "b1" }));
         fc.add(sb.buildFeature("2", new Object[] 
{geomFac.createPoint(new Coordinate(2,2)), "a2", "b2" }));

         KMLConfiguration con = new KMLConfiguration();

         Encoder encoder = new Encoder(con);
         encoder.setIndenting(true);
         encoder.encode(fc, KML.kml, System.out);
     }

-- 
SDDB Consulting GmbH
Wilhelm-Busch Str. 3
31832 Springe

Phone        +49 5045 962773
Mobil        +49 178 716 20 11
Mail         [email protected]



------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to