Questions about using JAK

195 views
Skip to first unread message

Caroline Uchiha

unread,
Jun 3, 2014, 8:50:53 PM6/3/14
to javaap...@googlegroups.com
Hi!
I'm new in JAK and i want to start using it. Do you have some tutorial or tips?
Because i want to convert XML files in KML :)

Ânderson Morais Soares

unread,
Feb 4, 2016, 5:20:23 AM2/4/16
to Java API for KML
Hi Caroline,

once you have an XML file called myXml, you should get it on a java.io.InputStream(this part you can find how to deal with googling, easily).
I don't know how is your XML formatted, so I'll consider you have a list of Points like <point>0.1,0.1</point>.

So iterate through your points list, and... follow

Kml kml = KmlFactory.createKml();
Document document = (Document) kml.getFeature();
List<Feature> featureList = document.getFeature();
 
Placemark placemark = KmlFactory.createPlacemark();
Point point = placemark.createAndSetPoint();
point
.getCoordinates().add(KmlFactory.createCoordinate(myXml.X, myXml.Y));
featureList
.add(placemark);

I hope I'm helping you
Reply all
Reply to author
Forward
0 new messages