Hi all hope all doing well.

I am trying to export a polygon as KML file but i am unable to get the file.

code :

GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory( null
);
WKTReader reader = new WKTReader( geometryFactory );

Encoder lEncoder = new Encoder(new KMLConfiguration());
OutputStream lFileOutputStream = null;
lEncoder.setIndenting(true);

try
{
lFileOutputStream = new FileOutputStream("my.kml");
Polygon polygon = (Polygon) reader.read("POLYGON((20 10, 30 0, 40 10, 30
20, 20 10))");
lEncoder.encode(polygon, KML.kml, lFileOutputStream);
lFileOutputStream.close();
}
catch (FileNotFoundException e1)
{
e1.printStackTrace();
}
catch (ParseException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}



Out put in my.kml file



<?xml version="1.0" encoding="UTF-8"?>
<kml:kml xmlns:atom="http://www.w3.org/2005/Atom";
    xmlns:kml="http://www.opengis.net/kml/2.2";
xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"/>




please help me where iam wrong





/*- – - – - – – - – – - – – - – – - – – - – – - – – - – – - – – - – – - -

Please consider your environmental responsibility.
Before printing this e-mail message, ask yourself whether you really need a
hard copy.

Life is what happens to you, while you're busy making other plans

We do not inherit the earth from our ancestors; we borrow it from our
children.
Leave them a living planet reduce your carbon foot print.
------------------------------------------------------------
--------------------------------*/






yours suri chinna
------------------------------------------------------------------------------
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to