How to mark multiple coordinates in KML using Java?

Posted by Akshay on Stack Overflow See other posts from Stack Overflow or by Akshay
Published on 2012-10-03T03:06:43Z Indexed on 2012/10/03 3:37 UTC
Read the original article Hit count: 191

Filed under:
|
|
|

I'm working on a project that involves KML creation using Java. Currently, I'm fooling with the sample Java code from the KML example at Micromata Labs JAK Example. I tried to "extend" the code by adding multiple coordinates and getting two markers, but I could not get it to work. Can you please tell me how I can add multiple coordinates and put markers on them, and also, draw a line between the markers. Thank you for your help!

PS: I need to do this via the program. I saw sample code of them using DOM and XML, but not pure Java/JAK as such. Please guide me.

I got as far as this:

kml
.createAndSetDocument().withName("My Markers").
createAndAddPlacemark().withName("London, UK").withOpen(Boolean.TRUE)
.createAndSetPoint().addToCoordinates(-0.126236, 51.500152);

kml.createAndSetPlacemark()
.withName("Somewhere near London, UK").withOpen(Boolean.TRUE)
.createAndSetPoint().addToCoordinates(-0.129800,52.700152);

But I know I'm going wrong somewhere. Please point me in the right direction.

© Stack Overflow or respective owner

Related posts about java

Related posts about kml