Hi Drew,

As I explained previously in this thread the recent kml 2.2 work was only
to support parsing kml, not generating it. So there is still some work that
has to be done to do encoding.

That said since kml 2.1 and 2.2 are generally pretty similar it doesn't
appear to be too hard. I just pushed a change that should now allow
geometries to be encoded in kml 2.2.


https://github.com/geotools/geotools/commit/398ddfd11b147558acbb4405faaf5999480a127e

It would be great if someone could update the rest of the bindings in a
similar way.

-Justin



On Thu, Jan 31, 2013 at 9:57 AM, drewcox <drew....@nokia.com> wrote:

> 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.
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_jan
> _______________________________________________
> GeoTools-Devel mailing list
> GeoTools-Devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>



-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to