I am trying to export features(polygons) in to a KML file. I am able to get KML file with the given features. Here all lines are coming in a white color. How can i give different colors to different polygons. Please suggest me.
Here my code
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName(plotName); builder.setCRS(DefaultGeographicCRS.WGS84); builder.add(sPolygon, Polygon.class); builder.length(32).add("AreaLocation", String.class); final SimpleFeatureType featureType = builder.buildFeatureType();
getting Feature Collection from featureList
SimpleFeatureCollection collection = new ListFeatureCollection(builder.getFeatureType(), featureList); //featureList list of all polygons
exporting as a kml
OutputStream stream = new FileOutputStream("my.kml"); Encoder encoder = new Encoder(new KMLConfiguration()); encoder.setIndenting(true); encoder.encode(collection, KML.kml, stream);