Reading a kml file

165 views
Skip to first unread message

Joan Llimiñana Sabaté

unread,
Jun 28, 2013, 6:21:48 AM6/28/13
to javaap...@googlegroups.com
This may be a very dumb question, but can I get a list of Placemark objects by reading a kml file / is there some exemple code about it?

Thomas Buissart

unread,
Jun 28, 2013, 8:14:06 AM6/28/13
to javaap...@googlegroups.com
Hello,

It depends on your kml file.
If you have a file .kml like :
<kml>
<Document>
<Placemark>...</Placemark>
<Placemark>...</Placemark>
....
</Document>
</kml>

You can get a list of placemark with this code :

Kml kml = Kml.unmarshal(yourFile);
Document doc = (Document) kml.getFeature();
List<Feature> features = doc.getFeature();

The feature list corresponds to your placemarks.
Hope it helped,
Thomas



Reply all
Reply to author
Forward
0 new messages