-1

Im trying to add time to my KML file and I have no idea how to add. I know that according to the format I need to add it before the coordinates but I cant find the right command.. Help would be much appreciated =) This is the code I have so far:

String time=filteredStrings.get(i).get(4);
String timestamp=TimeConvert(time); // a function to get the right time format
String Location=filteredStrings.get(i).get(1)+","+filteredStrings.get(i).get(0);    
    doc.createAndAddPlacemark().withName("point"+i).withOpen(Boolean.TRUE).createAndSetTimeStamp().addToObjectSimpleExtension(timestamp)
            .createAndSetPoint().addToCoordinates(Location);
4

1 回答 1

0

createAndSetTimeStamp() 方法返回 TimeStamp 对象而不是地标,因此在创建时间戳后设置位置不起作用。

只需创建一个地标对象,然后在其上设置位置和时间。

    Placemark place =  doc.createAndAddPlacemark().withName("point1")
            .withOpen(Boolean.TRUE);
    place.createAndSetPoint().addToCoordinates(Location);
    place.createAndSetTimeStamp().withWhen("2017-11-22T00:00:00Z");
于 2017-11-22T15:55:36.580 回答