From: drewcox <dre...@no...> - 2013-01-31 16:58:02
|
Hi, We too are trying to make use of the KML support in 8.6 stable to generate KML from ESRI Shapefiles. We would like to generate KML 2.2, but have not been successful. The examples online all seem to use the default org.geotools.kml package, which results in KML 2.1 XML, like: <?xml version="1.0" encoding="UTF-8"?> <kml:Polygon xmlns:kml="http://earth.google.com/kml/2.1"> <kml:outerBoundaryIs> <kml:LinearRing> <kml:coordinates>-115.17106956335083,36.08242087647367 -115.17246001114137,36.082425651432125 -115.17255380637391,36.082676888621286 -115.16792819990825,36.08278634227663 -115.17023232416489,36.08273184317541 -115.17040567238946,36.08246989479518 -115.17106956335083,36.08242087647367</kml:coordinates> </kml:LinearRing> </kml:outerBoundaryIs> </kml:Polygon> When switching to the org.geotools.kml.v22; package results in an empty document, like: <?xml version="1.0" encoding="UTF-8"?> <kml:Polygon 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"> <kml:outerBoundaryIs/> </kml:Polygon> Code I am using is: Encoder encoder = new Encoder(new KMLConfiguration()); encoder.setIndenting(true); String kmlString; try { kmlString = encoder.encodeAsString(polygon, KML.Polygon); } catch (IOException e) { throw new RuntimeException("Could not parse WKT to KML", e); } Thanks Drew -- View this message in context: http://osgeo-org.1560.n6.nabble.com/improved-kml-parsing-tp5019686p5031254.html Sent from the geotools-devel mailing list archive at Nabble.com. |